I
Ian Cass
Guys, why doesn't this program release its memory?
use strict;
my $t = "test";
for (my $i = 0; $i < 25; $i++) {
$t .= $t;
}
$t = '';
print "Allocated and freed memory\n";
<>;
When I do a 'ps' to see the memory in use, I see the following
ian.cass 10724 6.4 12.8 136496 132592 pts/0 S 13:44 0:00 perl t.pl
Why isn't $t = '' freeing the memory that was allocated in the previous for
loop?
Tested on Debian Linux 2.6.2 kernel with Perl 5.8.3 and on Redhat Linux
2.4.20 kernel with Perl 5.8.0
use strict;
my $t = "test";
for (my $i = 0; $i < 25; $i++) {
$t .= $t;
}
$t = '';
print "Allocated and freed memory\n";
<>;
When I do a 'ps' to see the memory in use, I see the following
ian.cass 10724 6.4 12.8 136496 132592 pts/0 S 13:44 0:00 perl t.pl
Why isn't $t = '' freeing the memory that was allocated in the previous for
loop?
Tested on Debian Linux 2.6.2 kernel with Perl 5.8.3 and on Redhat Linux
2.4.20 kernel with Perl 5.8.0