Memory leak in Perl 5.12.1

[email protected] (Mark Berryman) Mon, 28 Jun 2010 15:32:27 -0600
Newsgroups perl.vmsperl
Message-ID <[email protected]>
Sometime between Perl 5.8.6 and 5.12.1 a memory leak was introduced into Perl and it appears to be in the glob function.  The following should reproduce the problem on any VMS system:

@dirs = glob('SYS$COMMON:[000000]*.DIR');

for (;;) {
  foreach (@dirs) {
    s|\[000000\]|\[|;
    $_ = substr($_, 0, rindex(uc($_), '.DIR')) . ']';
    @files = glob($_ . '*.*;*');
  }
}

Execute this and then repeatedly hit control-T to watch your memory consumption climbing.  Let it run long enough and it will eventually abort due to insufficient virtual memory.

Mark Berryman