R has some tools for memory profiling, like Rprofmem(), Rprof() with option "memory.profiling=TRUE" and tracemem(). The last one can only be used on objects, and hence is useful to follow how many times an object is copied, but doesn't give an overview on a function basis. Rprofmem should be able to do that, but the output of even the simplest function call like lm() gives over 500 lines of log. I tried to figure out what Rprof("somefile.log",memory.profile=T) actually does, but I don't think I really get it.
The last I could find was this message of Thomas Lumley, saying that, and I quote :
I do not yet have tools to summarize the output.
This was in 2006. Any chance there are options for some nice summaries now, based on either Rprofmem(), the mysterious output of Rprof() with memory.profile set TRUE or any other tool?
profvislooks like the the solution to this question.It generates an interactive .html file (using
htmlwidgets) showing the profiling of your code.The introduction vignette is a good guide on its capability.
Taking directly from the introduction, you would use it like this:
Which gives