[R] Garbage Collecting

Kjetil Kjernsmo kjetil.kjernsmo at astro.uio.no
Sat Jun 24 20:15:54 CEST 2000


Thanks for the reply!

On 24 Jun 2000, Peter Dalgaard BSA wrote:

>
>Hm. I think I would do that as
>
>do.call("rbind", lapply(rep(1000000,4), lineprofile, ....) 

OK! This is kind of Perly, I guess, I have just tried to find something
that gives the matrix I need, no doubt there are better ways.

Huh, actually this called crashed R on my first run... Core dump (Again
huge!) at <URL:http://www.astro.uio.no/~kjetikj/tmp/Rcore2>.

On the second run, it exhibits the same problem as with the other code
(but it does seem to run faster indeed!). To free the heap I quit and
restart.

>(provided I grasped the intention correctly). Still looks strange,
>though, and as usual I wouldn't rule out that there might be a problem
>with 32/64 bit assumptions somewhere since we have so few people on 64
>bit platforms. 

Hm, ok.

>In general, the garbage collector should indeed remove anything that
>is not used by an active R object or is otherwise protected. So if
>lineprofile doesn't have any side effects, then only the return value
>should be left after the call.

No, lineprofile doesn't have any side effects, I never use '<<-' and
things like that (I have been writing to a file with this code, but that
is currently commented out, it was an unrelated sanity check I performed).

>Perhaps you could cut the size of the problem down a bit? Some of us
>are sitting at machines with 64MB RAM and are not too thrilled about R
>processes with 200+ MB of memory footprint...

I can imagine. The code would run with vsize=30M as well, I just tried.
Actually, I never did any calculations on how much RAM I should be needing
to run my code, so perhaps my huge heap sizes are due to that I have had
this problem before and made large heap sizes only by experience, without
reflecting on why I use it (though I have also had .RData files of
~150MB).

>If you're feeling adventurous, Luke Tierney has just opened up an
>experimental branch with a substantially modified garbage collector. 

Wow!

>I
>believe there's a way to get it by anonymous CVS, the branch label is
>R-GenGC. However, that one should be *less* strict about cleaning out
>every last bit of unused data than the current one (in the hope of
>getting better speed in return).

I'll give it a thought, but most likely, I'll try to find some 32 bit
computers to check out as well.

Best,

Kjetil
-- 
Kjetil Kjernsmo
Graduate astronomy-student                    Problems worthy of attack
University of Oslo, Norway            Prove their worth by hitting back
E-mail: kjetikj at astro.uio.no                                - Piet Hein
Homepage <URL:http://www.astro.uio.no/~kjetikj/>
Webmaster at skepsis.no 


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list