in reply to Re: Memory leak on definition of anonymous code?
in thread Memory leak on definition of anonymous code?

For the curious, here is the leaky code fixed with WeakRef:
use strict; use WeakRef; while(1) { &leak(); } sub leak { my $sub_ref; $sub_ref = sub { &$sub_ref(); }; weaken($sub_ref); # <- This fixes the leak return 0; }