On 5/18/11 Wed May 18, 2011 5:16 PM, "Jim Green"
<[email protected]> scribbled:
> Hello List!
> I have a quick question about memory release in perl:
>
> {
> my @array;
>
> foreach my $n (1..1e7 ) {
> push @array, $n;
> print "$n\n";
> }
> }
>
> print "sleeping\n";
> sleep 600;
>
> after the code block, I epxect memory usage to drop to almost zero
> because @array went out of scope. but when I do top after it executes
> after the code block it still has huge memory usage..
>
> Could anyone give me some explanation?
See the explanation in 'perldoc -q array'
"How can I free an array or hash so my program shrinks?"
Perl hangs on to the memory and does not return it back to the operating
system.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/