in reply to memory deallocation
Oha
update: after some tests, i found that allocating memory for an array will free to OS after undef-ing the array, but that will not apply to the data in the array itself:
the mem freed to OS after the second undef is pretty close the same as the first (difference), so only the memory allocade by the strings aren't freed to OS. i still wonder why...my @x; system "ps aux | grep $$ | grep [p]erl"; $x[1_000_000] = "foo"; system "ps aux | grep $$ | grep [p]erl"; undef @x; system "ps aux | grep $$ | grep [p]erl"; push @x, "$_" for(1..1_000_000); system "ps aux | grep $$ | grep [p]erl"; undef @x; system "ps aux | grep $$ | grep [p]erl"; ------ oha 8305 0.0 0.2 3296 1232 pts/0 S+ 19:55 0:00 perl t4 +.pl oha 8305 0.0 0.9 7204 5148 pts/0 S+ 19:55 0:00 perl t4 +.pl oha 8305 0.0 0.2 3296 1244 pts/0 S+ 19:55 0:00 perl t4 +.pl oha 8305 76.0 8.6 46896 44800 pts/0 S+ 19:55 0:00 perl t4 +.pl oha 8305 98.0 7.8 42796 40704 pts/0 S+ 19:55 0:00 perl t4 +.pl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: memory deallocation
by Fletch (Bishop) on Oct 01, 2007 at 14:35 UTC | |
by ikegami (Patriarch) on Oct 01, 2007 at 14:40 UTC | |
|
Re^2: memory deallocation
by Nova (Novice) on Oct 01, 2007 at 17:45 UTC |