in reply to Re: Clearing an Array of Array's from memory
in thread Clearing an Array of Array's from memory
Letting a variable fall out of scope doesn't free up all its memory. The memory used for the members of an aggregate (array or hash) are generally freed, however the memory used for the structure of the variable (including scalars) aren't freed--they are instead saved in case the scope is re-entered. Notice:
printsuse Devel::Size qw(size); $foo = 2; while ($foo--) { { my $bar; print Devel::Size::size(\$bar), " ", length($bar), "\n"; $bar = " " x 10000000; } }
not12 0 10000025 0
which is what you'd expect if the memory was actually freed on scope exit.12 0 12 0
In Section
Seekers of Perl Wisdom