in reply to How do I free memory allocated to an array
Even if you may not be able to return memory to the operating system, you may be able to re-use it within your process. Try the following sample:
You'll see that perl really returns (parts of) the memory used for $X after is has been destroyed. (I didn't expect this, too :-) ).sub S { system "ps u $$"; } &S; my $X = "x"x10240000; &S; undef $X; &S; $X = "x"x10240000; &S; undef $X; &S;
|
|---|