Profiling R memory consumption within external packages

180 Views Asked by At

I'm profiling my R code time and memory consumption using lineprof. This gives good results for explicit commands I write, however when i use external packages it doesn't give the required information. For example, i try running the following (using igraph):

library(igraph)
communityCalc <- function(n, p) {
   graph <- erdos.renyi.game(n, p, directed = FALSE, loops = FALSE)
   community <- leading.eigenvector.community(graph)
}
memoryProfile <- lineprof(communityCalc(n=10000, p=0.0014))
shine(memoryProfile)

The results I get for memory is that even though creating the graph takes up much memory, the community calculation doesn't. The reason is that "community" is a small data structure. I would like to somehow get the amount of memory allocated by "leading.eigenvector.community" function, and not just the output. If possible i would like deeper resolution showing even results within the function.

0

There are 0 best solutions below