in reply to "goto" memory leak
Strictly speaking, it's a not a leak: the memory is reclaimed on scope exit. This code doesn't grow in memory usage after the first iteration of the while loop:
Part of the run-time action of 'my' is to make a note to free the lexical at scope exit. The goto causes additional notes to be pushed on the savestack without any scope being exited. When the scope is finally exited, all the notes are popped off the savestack and processed.while (1) { $i = 0; again: my $x; goto again if $i++ < 100_000_000; }
Dave.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: "goto" memory leak
by jethro (Monsignor) on Mar 30, 2016 at 12:35 UTC | |
by ikegami (Patriarch) on Mar 30, 2016 at 13:15 UTC | |
by jethro (Monsignor) on Mar 30, 2016 at 14:24 UTC | |
by dave_the_m (Monsignor) on Mar 30, 2016 at 18:27 UTC | |
by jethro (Monsignor) on Mar 31, 2016 at 13:03 UTC | |
| |
by ikegami (Patriarch) on Mar 31, 2016 at 02:40 UTC | |
by jethro (Monsignor) on Mar 31, 2016 at 13:15 UTC | |
| |
by Anonymous Monk on Mar 30, 2016 at 19:26 UTC |
In Section
Seekers of Perl Wisdom