[Rd] Small memory leak in plot on OS X (PR#11170)

abergeron at gmail.com abergeron at gmail.com
Tue Apr 15 02:15:08 CEST 2008

Full_Name: Arnaud Bergeron
Version: 2.6.2
OS: Mac OS X 10.5.2
Submission from: (NULL) (

When I run the following loop

repeat { plot(seq(5), seq(5)) }

the memory consumed by the process goes up by a small amout each time. I tried
this with the quartz() and pdf() output devices.  Only a single output device is
created by the process and is repeatedly overwritten by plot().

Also even if I close the device with dev.off() the memory is never released,
even after a gc() pass.  In fact the gc() pass reports way less memory used than
what the system reports.  I can understand a discrepancy in the numbers here,
but 9.1Mb (reported by gc()) versus 415Mb (reported by the system) is not normal
in my eyes.

With the png() device, the results were less conclusive. I'd say there was a
slight overall augmentation of used memory, but may that's just me.  Note that
this device creates many files by default and the problem does not seem to
happen when it does this.

Below is the sessionInfo() output:

R version 2.6.2 (2008-02-08) 


attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

More information about the R-devel mailing list