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.
In Section
Seekers of Perl Wisdom