A call of gc causes a garbage collection to take place. gcinfo sets a flag so that automatic collection is either silent (verbose = FALSE) or prints memory usage statistics (verbose = TRUE).
gc(verbose = getOption("verbose"), reset = FALSE, full = TRUE)
gcinfo(verbose)
| Parameter | Description |
|---|---|
verbose |
logical; if TRUE, the garbage collection prints statistics about cons cells and the space allocated for vectors. |
reset |
logical; if TRUE the values for maximum space used are reset to the current values. |
full |
logical; if TRUE a full collection is performed; otherwise only more recently allocated objects may be collected. |
# NOT RUN {
gc() #- do it now
gcinfo(TRUE) #-- in the future, show when R does it
x <- integer(100000); for(i in 1:18) x <- c(x, i)
gcinfo(verbose = FALSE) #-- don't show it anymore
gc(TRUE)
gc(reset = TRUE)
# }