[R] Memory leak using Rgraphviz

Andreas Yankopolus andreas at yank.to
Fri Jun 4 00:37:09 CEST 2010


I should have mentioned in my initial email: running gc() doesn't help.

You can run something like the following and watch memory usage soar:

for (ii in 1:10000) { 
   foo()
   gc()
}

Thanks,

Andreas

On Jun 3, 2010, at 18:24, Corey Dow-Hygelund wrote:

> It appears you are facing a garbage collection issue.
> 
> ?gc
> 
> Corey
> 
> On Thu, Jun 3, 2010 at 3:13 PM, Andreas Yankopolus <andreas at yank.to> wrote:
> I'm running an Ubuntu 10.04 system and installed R 2.10.1 through the package manger. I then installed Rgraphviz 1.24 and graph 1.26 through R.
> 
> I'm trying to understand why a complex function my team wrote causes R's memory footprint viewed through top to increase every time it's run. I traced the increase in memory usage to layoutGraph() and wrote the following short function that reproduces the problem:
> 
> foo <- function () {
>  library(Rgraphviz)
>  set.seed(123)
>  V <- letters[1:26]
>  M <- 1:2
>  g1 <- randomGraph(V, M, 0.5)
>  edgemode(g1) <- "directed"
>  x <- layoutGraph(g1,name="foo",layoutType="twopi", recipEdges="distinct")
> }
> 
> I expected that any memory allocated by this function would be freed when it returns, but that's not the case. Is there something that I need to be doing to to clean up after using layoutGraph?
> 
> Thanks,
> 
> Andreas
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 



More information about the R-help mailing list