[Israel.pm] Garbage Collection Question
Gaal Yahas
gaal at forum2.org
Sat May 8 14:22:54 PDT 2004
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/
More information about the Perl
mailing list