26

How to interpret result of gc() :

Garbage collection 9 = 1+0+8 (level 2) ... 
10.7 Mbytes of cons cells used (49%)
40.6 Mbytes of vectors used (72%)
          used (Mb) gc trigger (Mb) max used (Mb)
Ncells  198838 10.7     407500 21.8   350000 18.7
Vcells 5311050 40.6    7421749 56.7  5311504 40.6

and how can we see if any garbage have been collected ?

Qbik
  • 5,885
  • 14
  • 62
  • 93
  • this is usefull to know because it helps to learn when you should and shouldn't call gc() in your script – Qbik Jan 27 '16 at 14:34
  • I think this question is answered at http://stackoverflow.com/q/14580233/602276 – Andrie Aug 11 '16 at 13:07

1 Answers1

4

Under the initial line it tells you the totals in con cells(Ncells -that is a 28 byte for 32 bit system and 56 bytes for a 64 bit system... ) then the total in vector cells (Vcells , they are 8 bytes)

The following table just breaks down how it was distributed:

The number cleared now under used, the number which would have triggered automatically and the max used PRIOR to gc() in the third column is the amount used since the prior reset.

If you want to see more details ?gc() in the console.....you get it all! And the base manual for R explains how garbage collection works. And ?Memory gives you an idea of how memory is allocated.

Edit: Finally, to see the results of a garbage collection, you could use an external resource monitoring applications. In windows, that just amounts to keeping the Task Manager open. In unix/linux, you could consult htop, or in macOS, the Activity Monitor app.

jkix
  • 184
  • 1
  • 2
  • 17
sconfluentus
  • 4,693
  • 1
  • 21
  • 40