in reply to How to avoid closures and memory leaks.
What memory leak? There's no memory leak in what you posted, and there's no mention of memory leaks in the document you mention as the basis for this.
This is how you get a memory leak from a closure:
my $foo; $foo = sub { ... $foo->() ... };
The sub reference $foo, and $foo is a reference to the sub. But you don't have that.
|
|---|