Search code examples
rgarbage-collection

Suppress output of gc()


Is there a possibility to suppress all messages of gc( ) in R?

The usual like suppressWarnings(gc( )) or suppressMessages(gc( )) don't work. gc( ) itself has a verbose option but this is not working how I like it:

> gc(verbose=TRUE)
Garbage collection 375 = 234+40+101 (level 2) ... 
17.9 Mbytes of cons cells used (41%)
171.2 Mbytes of vectors used (43%)
used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells   334493  17.9     818163  43.7   818163  43.7
Vcells 22431904 171.2   52178020 398.1 50193465 383.0
> gc(verbose=FALSE)
used  (Mb) gc trigger  (Mb) max used  (Mb)
Ncells   334496  17.9     818163  43.7   818163  43.7
Vcells 22431916 171.2   52178020 398.1 50193465 383.0

Thanks in advance!


Solution

  • I sometimes use invisible(gc()).