Re: Memory leak in Perl 5.12.1

[email protected] ("Craig A. Berry") Wed, 30 Jun 2010 19:52:05 -0500
Newsgroups perl.vmsperl
Message-ID <[email protected]>
On Jun 28, 2010, at 4:32 PM, Mark Berryman wrote:

> 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.
>

I can confirm that it chews memory pretty fast (about 4,000 pages  
every 5 seconds on my rx2600).  There is a Perl_vms_start_glob()  
function in [.vms]vms.c if anyone is hankering after a session with  
the heap analyzer and wants to know where to look.  I hope to look  
into this at some point but can't commit to when.

________________________________________
Craig A. Berry
mailto:[email protected]

"... getting out of a sonnet is much more
  difficult than getting in."
                  Brad Leithauser