in reply to Re^4: out of memory problem
in thread out of memory problem
Suppose I write a module which provides a "frobnicate" function:
sub frobnicate { my ($string) = @_; $string =~ s/foo/bar/g; return $string; }
Suppose I write a program that runs for a really long time, and uses "frobnicate" only once during its initialization, and it passes a really long string to it.
Should I expect that $string will hold this long string for the program's lifetime? Am I supposed to undef every single variable to avoid this? (Which would pretty much nullify this "optimization", but it seems to be the only way to avoid the memory leak.)
Update: Replaced the code of the example function.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: out of memory problem
by ikegami (Patriarch) on Sep 13, 2008 at 21:26 UTC | |
|
Re^6: out of memory problem
by BrowserUk (Patriarch) on Sep 13, 2008 at 21:37 UTC |