Skip to content

Instantly share code, notes, and snippets.

@multimeric
Last active March 13, 2024 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save multimeric/8ebb7948b5ad3384649da63bc0e59bb9 to your computer and use it in GitHub Desktop.
Save multimeric/8ebb7948b5ad3384649da63bc0e59bb9 to your computer and use it in GitHub Desktop.
Demonstration of odd memory usage in R whereby the resident set size (RSS) doesn't change despite allocating more memory and later clearing it
```{r}
RSQLite::SQLite() |>
DBI::dbConnect(":memory:") |>
RSQLite::dbWriteTable("foo", data.frame(
a = numeric(1E8)
))
invisible(gc())
ps::ps_memory_info()
y <- integer(1E8)
ps::ps_memory_info()
rm(y)
invisible(gc())
ps::ps_memory_info()
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment