in reply to Re^5: XML::Twig loves to eat my memory
in thread XML::Twig loves to eat my memory
Unless I misunderstand the purpose of dispose I would expect memory to be released...
Yes. (Actually, it sounds like it's doesn't do anything on a system will a properly installed Scalar::Util because it's done automatically then.)
...and the size of the process to go down.
That does not follow. Freeing memory does not necessarily make the process size go down. It's only guaranteed to go back to Perl's free memory pool. In some circumstances on some OSes, the process size can go down, but there's no guarantee of it.
For example, you could observe the following:
my $x; $x .= "a" for 1..1024; # Process size goes up undef $x; # Process size doesn't go down $x .= "a" for 1..1024; # Process size doesn't go up
undef $x; freed the string's buffer — observable with Devel::Peek — but it might not release it to the OS. However, Perl will now be able to reuse that memory to rebuild $x.
To see if the memory is freed, what you need to do is use some memory and see if the process goes up. Do as almut suggested and call process twice in a row, checking the process size after each call.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: XML::Twig loves to eat my memory
by carcus88 (Acolyte) on Jul 23, 2010 at 14:43 UTC | |
by ikegami (Patriarch) on Jul 23, 2010 at 15:39 UTC | |
by carcus88 (Acolyte) on Jul 23, 2010 at 16:33 UTC | |
by ikegami (Patriarch) on Jul 24, 2010 at 13:38 UTC | |
by Anonymous Monk on Jul 23, 2010 at 16:55 UTC | |
by toolic (Bishop) on Jul 23, 2010 at 14:49 UTC | |
by ikegami (Patriarch) on Jul 23, 2010 at 15:37 UTC |