fng has asked for the wisdom of the Perl Monks concerning the following question:
I getuse Scalar::Util qw(weaken); my $count = 3000; do { print "".(`ps -p $$ -o size=`+0)." " if ! ($count % 100); my $x = \("abcdefghijklmnopqrstuvwxyz" x 8000); my $y = $x; weaken $y; } while $count--;
1128 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544
But if I do thisi get thisuse Scalar::Util qw(weaken); my $count = 3000; do { print "".(`ps -p $$ -o size=`+0)." " if ! ($count % 100); my $x = {x=>"abcdefghijklmnopqrstuvwxyz" x 8000}; my $y = $x; weaken $y; } while $count--;
1128 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1544 1676 1676 1676 1676 1676 1676 1676 1676 1676 1676 1808 1808 1808 1808 1808 1808
The more iterations, the more it leaks. Why? (perl 5.10.0 here)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: process size and weaken
by ikegami (Patriarch) on Sep 03, 2009 at 00:25 UTC | |
by Burak (Chaplain) on Sep 03, 2009 at 02:43 UTC |