develooper Front page | perl.perl5.porters | Postings from February 2004

Re: [perl #26785] mem leak in split

Thread Previous | Thread Next
From:
Yitzchak Scott-Thoennes
Date:
February 18, 2004 16:22
Subject:
Re: [perl #26785] mem leak in split
Message ID:
20040219002207.GA2204@efn.org
On Tue, Feb 17, 2004 at 02:56:38PM -0000, "Ohlman, Jeff" wrote:
> I am trying to split a record twice - the 2nd split takes an element of the first split and splits it again.  Trying to assign the results of the 2nd split to another array causes the OS to produce:
>  
> Out of memory during request for 1008 bytes, total sbrk() is 64858324 bytes!
>  
> I've reduced the program to the bare min in order to reproduce the error.  This is the offending code:
>  
> perl -ne 'chomp;@x=split(/< /,$_);@r=split(/~/,$x[1]);'">!@ <mailto:!@> >/,$_);@r=split(/~/,$x[1]);' reallybigfile.dat
>  
> The work around is:
>  
> perl -ne 'chomp;@x=split(/< /,$_);($a">!@ <mailto:!@> >/,$_);($a, $b, $c, $d, $e) =split(/~/,$x[1]);' reallybigfile.dat

Those don't look like valid perl.  I think you might have left
something out.  In any case, could you try putting my(@r); before
using @r and let us know if this helps?  That will disable an
optimization that might be causing the trouble.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About