The ca. 750 extra bytes for named subs may well be just the cost of allocating a GLOB for the subroutine in the symbol table,
Running the code below to create a million STASH aliases to a single sub:
sub F123456{ my( $a, $b, $c )= @_; my $x = 123456; return $a * $b - $ +c; };; *{"X$_"} = \&F123456 for 0 .. 1e6;;
results in an increase in the process size of almost exactly 300MB, thus 300 bytes per STASH entry.
Some of the extra space may be down to unreused (but reusable) space allocated and freed during the doubling of the STASH hash as it grows. I can't think of any way to isolate that.
In reply to Re^2: Memory efficiency, anonymous vs named's vs local subroutines
by BrowserUk
in thread Memory efficiency, anonymous vs named's vs local subroutines
by thanos1983
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |