Since you are talking about garbage collection (memory shrinking) you
might want to re-read the thread I've started back in Aug, 99:
http://forum.swarthmore.edu/epigone/modperl/zarwhegerd

It includes the real show case of memory shrinking (at least on Linux). 
Consider this code: 

-------------------------------------------------------
use GTop;
my $gtop = GTop->new;
print "Content-type: text/plain\n\n";

print "before       :", $gtop->proc_mem($$)->size,"\n";
{ push my @x, "A" x 1000000;
  print "in scope     :", $gtop->proc_mem($$)->size,"\n";
}
print "out of scope :", $gtop->proc_mem($$)->size,"\n";
-------------------------------------------------------

prints on a freshly started server:
before       :6111232
in scope     :8118272
out of scope :7114752

and on a second invocation:

before       :7118848
in scope     :8122368
out of scope :7118848

What do you say? 1003520 bytes are returned to OS when @x goes out of
scope. Note that this doesn't happen if you use a global @x instead.

But hey why did I need mod_perl for the test, stupid me :) Running the
above code as a Perl script from the command line gives:

before       :1527808
in scope     :3543040
out of scope :2539520

The machine is running linux x86 (RH6.1) kernel 2.2.12-20smp, perl5.005_03

______________________________________________________________________
Stas Bekman             | JAm_pH    --    Just Another mod_perl Hacker
http://stason.org/      | mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]  | http://perl.org    http://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
----------------------------------------------------------------------

Reply via email to