in reply to Re^2: Perl 5.10 eval($string) memory leak
in thread Perl 5.10 eval($string) memory leak
Wouldn't it make sense to move your first occurrence of:
$index = int(rand($symbol_size));
... inside the while loop (right at the top of the loop), and then remove the occurrence at the end of the loop?
That is, not:
foo(); while (1) { bar(); foo(); }
But instead:
while (1) { foo(); bar(); }
It should have the same effect; be more compact and avoid repetition.
Anyway, I believe the reason you're leaking memory is that your evaluated strings can end up containing variables, and those variables are not lexicals, so they get stored in the package stash.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl 5.10 eval($string) memory leak
by fuzzmonkey (Sexton) on Aug 16, 2013 at 20:29 UTC |