Skip to content

Instantly share code, notes, and snippets.

@jangorecki
Created May 13, 2026 18:34
Show Gist options
  • Select an option

  • Save jangorecki/87d91fed78aef9f8022b6a914fe7f26a to your computer and use it in GitHub Desktop.

Select an option

Save jangorecki/87d91fed78aef9f8022b6a914fe7f26a to your computer and use it in GitHub Desktop.
mem <- function(.gc_start) {
.gc_end <- gc(verbose = FALSE, reset = FALSE)
round(sum((.gc_end[, 5L] - .gc_start[, 5L]) * c(56, 8)) / 1024^2, 3)
}
.gc <- gc(verbose = FALSE, reset = TRUE)
for (i in 1:3) rnorm(1e8)
print(mem(.gc))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment