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

Hao Yu hyu at stats.uwo.ca
Wed Sep 5 15:16:59 CEST 2012


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.

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



More information about the R-sig-hpc mailing list