[R] Memory leak using Rgraphviz

Andreas Yankopolus andreas at yank.to
Fri Jun 4 00:13:40 CEST 2010


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



More information about the R-help mailing list