develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [perl #24061] shared array memory leak in 5.8.1

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
October 23, 2003 13:51
Subject:
Re: [perl #24061] shared array memory leak in 5.8.1
Message ID:
20031023205127.GC397@fdgroup.com
On Mon, Sep 29, 2003 at 08:16:22PM +0300, Enache Adrian wrote:
> On Mon, Sep 29, 2003 a.d., Dave Mitchell wrote:
> > On Sun, Sep 28, 2003 at 04:27:36PM -0000, Eric Garland wrote:
> > > This program will make perl 5.8.1 expand to using 350 mb on my linux 
> > > machine within 60 seconds: 
> > > 
> > > 
> > > use threads;
> > > use threads::shared;
> > > my @shared : shared;
> > > @shared = (1) while (1);
> > 
> > It's leaking 1 shared-interpreter SV per iteration. Not sure what the SV
> > is yet. May not have time to investigate further.
> 
> Look at ext/threads/shared/shared.xs - sharedsv_elem_mg_STORE().
> The svp got with 'av_fetch(..,1)' has its refcnt incremented from 1 to 2
> by Perl_sharedsv_associate(). When the array is cleared, it won't be
> freed.

Turned out to be slightly different. The AV in the shared interpreter
wasn't geting its AvREAL flag set, so when cleared, it wasn't
REFCNTdec-ing its elements.

Fixed in bleedperl by change #21527.

Dave.


-- 
Please note that ash-trays are provided for the use of smokers,
whereas the floor is provided for the use of all patrons.
	- Bill Royston

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