Hello, fellow monks!
Imagine this:
my @arr = (9) x 1000_000; my $code = sub { @arr }; undef $code;
The sub will create a local copy of @arr as it's really a closure not a simple sub. And as soon as the ref to the sub vanishes we lose ability to address that copy. Will it be garbage-collected? Anonymous subs cannot be GCed as far as I understand, the code is there forever, and what about the scratchpad (I may misuse the term) for copies of lexical vars?
Are there ways to creatively employ Devel::Size, Devel::Peek, B::LexInfo or some other module to get information on all currently allocated objects? The ps(1) is rather useless in this case because perl process may not return (on some systems it even cannot) the memory to the OS as soon as it's freed.
In reply to Lost anonymous subs by kappa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |