Why does my Perl program keep growing in size?
While there may be a real memory leak in the Perl source code or even
whichever malloc() you're using, common causes are incomplete eval()s
or local()s in loops.
An eval() which terminates in error due to a failed parsing
will leave a bit of memory unusable.
A local() inside a loop:
for (1..100) {
local(@array);
}
will build up 100 versions of @array before the loop is done.
The work-around is:
local(@array);
for (1..100) {
undef @array;
}
Larry reports that this behavior is fixed for perl5.