[R] memory management

Bert Gunter gunter.berton at gene.com
Tue Feb 28 21:02:29 CET 2012


On Tue, Feb 28, 2012 at 11:57 AM, Sam Steingold <sds at gnu.org> wrote:
> My basic worry is that the GC does not work properly,
> i.e., the unreachable data is never collected.

Highly unlikely. Such basic inner R code has been well tested over 20
years.  I believe that you merely don't understand the inner guts of
what R is doing here, which is the essence of my response. (Clearly, I
make no claim that I do either).

I suggest you move on.

-- Bert

>
>> * Bert Gunter <thagre.oregba at trar.pbz> [2012-02-27 14:35:14 -0800]:
>>
>> This appears to be the sort of query that (with apologies to other R
>> gurus) only Brian Ripley or Luke Tierney could figure out. R generally
>> passes by value into function calls (but not *always*), so often
>> multiple copies of objects are made during the course of calls. I
>> would speculate that this is what might be going on below -- maybe
>> even that's what you meant.
>>
>> Just a guess on my part, of course, so treat accordingly.
>>
>> -- Bert
>>
>> On Mon, Feb 27, 2012 at 1:03 PM, Sam Steingold <sds at gnu.org> wrote:
>>> It appears that the intermediate data in functions is never GCed even
>>> after the return from the function call.
>>> R's RSS is 4 Gb (after a gc()) and
>>>
>>> sum(unlist(lapply(lapply(ls(),get),object.size)))
>>> [1] 1009496520
>>>
>>> (less than 1 GB)
>>>
>>> how do I figure out where the 3GB of uncollected garbage is hiding?
>
> --
> Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
> http://www.childpsy.net/ http://jihadwatch.org http://memri.org
> http://palestinefacts.org http://truepeace.org http://iris.org.il
> I may be getting older, but I refuse to grow up!



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list