So the simple answer is to avoid having both sides of the 'x' operator as constants. For example, this will fix your situations:
my $VAR = makeA(20000000); sub makeA { return 'A' x (shift) }
This would also fix it:
my $VAR = make20m('A'); sub make20m { return (shift) x 20000000 }
The conclusion seems to be that perl the constant itself occupies memory, and then the variable gets its own copy of the constant.
In reply to Re^2: Memory usage double expected
by sectokia
in thread Memory usage double expected
by sectokia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |