R release memory by gc in silence -
R release memory by gc in silence -
i running r code in ubuntu , want release memory. after remove (rm) variables, phone call gc(). seems works. how can create work in silence(don't study message). tried set "gcinfo(verbose=false)", gc still reports message. thanks
> gcinfo(verbose=false) [1] false > gc() used (mb) gc trigger (mb) max used (mb) ncells 256641 13.8 467875 25.0 350000 18.7 vcells 103826620 792.2 287406824 2192.8 560264647 4274.5
the invisible()
function useful this. 1 way write little gc()
wrapper function of own without arguments returns gc()
invisibly.
gcquiet <- function(quiet = true, ...) { if(quiet) invisible(gc()) else gc(...) } gcquiet() ## runs gc() invisibly gcquiet(false) # used (mb) gc trigger (mb) max used (mb) # ncells 283808 15.2 531268 28.4 407500 21.8 # vcells 505412 3.9 1031040 7.9 896071 6.9 gcquiet(false, verbose=true) # garbage collection 26 = 12+1+13 (level 2) ... # 15.2 mbytes of cons cells used (53%) # 3.9 mbytes of vectors used (49%) # used (mb) gc trigger (mb) max used (mb) # ncells 283813 15.2 531268 28.4 407500 21.8 # vcells 505412 3.9 1031040 7.9 896071 6.9
r memory garbage-collection
Comments
Post a Comment