[R] Keeping track of memory usage

Stavros Macrakis macrakis at alum.mit.edu
Fri Aug 21 07:30:51 CEST 2009


How can I determine how much memory a given piece of my code is
allocating (directly or indirectly)? -- essentially, the space
analogue of system.time, something like this:

      system.space( x <- rnorm(10000) )
      10000 Vcells

      system.space( for (i in 1:1000) x <- rnorm(10000) )
      10000000 Vcells

I'm not looking for anything as fine-grained as Rprofmem or tracemem,
just the overall allocations.  I'm also not looking for the amount of
*live* memory (that is, net of garbage collection) as reported by
memory.profile or gc.

Thanks,

          -s




More information about the R-help mailing list