[Israel.pm] Garbage Collection Question

Yossi.Itzkovich at ecitele.com Yossi.Itzkovich at ecitele.com
Sat May 8 20:12:52 PDT 2004






Hi,

As far as I know , this is  OS dependent.  On Unix (and it is not
Perl-depended) freed memory doesn't go back to system, untill the process
is done.

Yossi



                                                                                                                                   
                      Gaal Yahas                                                                                                   
                      <gaal at forum2.org         To:      Perl in Israel <perl at perl.org.il>                                          
                      >                        cc:                                                                                 
                      Sent by:                 Subject: Re: [Israel.pm] Garbage Collection Question                                
                      perl-bounces at per                                                                                             
                      l.org.il                                                                                                     
                                                                                                                                   
                                                                                                                                   
                      05/09/2004 00:22                                                                                             
                      Please respond                                                                                               
                      to Perl in                                                                                                   
                      Israel                                                                                                       
                                                                                                                                   
                                                                                                                                   



On Sat, May 08, 2004 at 10:19:51PM +0300, Issac Goldstand wrote:
> Even if the GC does collect it AFAIK it will not release the memory back
to
> the system until Perl exits - rather it will save the memory for other
> variables (or anything else in the Perl process which wants it).  Maybe
I'm
> remembering wrong, though...

I remembered that too, but had to check. It turns out that in some cases,
at least a new perl *does* release memory to the OS. You can easily
verify this with these two one-liners:

perl -0777e 'big(); sleep 5; print `ps aux|grep $$`;
    sub big {my $big=<>}'                 /some/200MB/file

Which on my system, doesn't free the memory, and

perl -0777e 'big(); sleep 5; print `ps aux|grep $$`;
    sub big {my $big=<>; undef $big}'     /some/200MB/file

which does.

This is perl, v5.8.4 built for i386-linux-thread-multi

--
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://www.perl.org.il/mailman/listinfo/perl






More information about the Perl mailing list