[R-sig-hpc] Possible memory leak for serialize?

Simon Urbanek simon.urbanek at r-project.org
Wed Sep 5 16:27:06 CEST 2012


On Sep 5, 2012, at 9:16 AM, Hao Yu <hyu at stats.uwo.ca> wrote:

> Hi.
> 
> serialize may have memory leak issue. When I run the following codes
> 
> x=split(1:40000, rep(1:8, 5000))
> fun=function(x)lapply(x, serialize, NULL)
> out =replicate(5000, fun(x))
> 
> After using gc() severally times, R reports about 800MB memory usage
> (objects fun, out and x) but the real memory usage is 2.4GB (reported from
> OS). After deleting all objects, R reports about 12MB usage but real
> memory usage is reduced to 1.7GB and will stay there.
> 

Please consider reading FAQ 7.42.

Cheers,
Simon





> Don't try with big size. I used up all my 16GB ram on my windows PC and
> caused other programs to crash.
> 
> I can reproduce this behave on both Windows and Debian with R 2.15.1
> 64bit. If this memory leak does exist, it may have impact on jobs with
> lots of R objects exchanges among nodes, in particularly master node.
> 
> Hao
> 
> PS: Changing fun to fun2=function(x)lapply(1:8,
>    function(i)serialize(x[[i]],NULL)) has no effect.
> 
> 
> -- 
> Department of Statistics & Actuarial Sciences
> Office Phone#:(519)-661-3622
> Fax Phone#:(519)-661-3813
> The University of Western Ontario
> London, Ontario N6A 5B7
> http://www.stats.uwo.ca/yu
> 
> _______________________________________________
> R-sig-hpc mailing list
> R-sig-hpc at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
> 
>



More information about the R-sig-hpc mailing list