develooper Front page | perl.perl5.porters | Postings from September 2010

Re: [perl #77352] Memory leaks in threaded Perl (cloning PVGVs andPL_my_cxt_list)

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
September 1, 2010 04:28
Subject:
Re: [perl #77352] Memory leaks in threaded Perl (cloning PVGVs andPL_my_cxt_list)
Message ID:
20100901112848.GA2782@iabyn.com
On Sat, Aug 21, 2010 at 08:02:14PM -0700, Jirka Hruška wrote:
> I would like to report two memory leaks in the threaded Perl
> interpreter. They are not very important in an average script,
> but in certain scenarios (like mine, running a long-term script
> on a semi-embedded device with limited RAM), they can be deadly.
> 
> First problem is in S_sv_dup_common() [sv.c]

Fix looks good thanks, applied as commit

    61e14cb44198449802cc50bc000890b1db9ba3f2

with minor comment tweaks

> The second issue deals with PL_my_cxt_list. As I understood,
> this list is initialized when needed during module load and
> correctly cloned when duplicating an interpreter for another
> thread, however it is never freed. Because I didn't find a way
> to release the contents properly (is there any?), I added at
> least a simple free of the array itself - seemed to work well
> enough (I probably haven't used any modules with context data).

The contents don't need to be freed as they point to the PVX fields
of SVs which get cleanup up later. So I've applied your fix with a change
to the comment, as commit

    57bb245860e35e488edc349867894087587a1af6

-- 
"You may not work around any technical limitations in the software"
    -- Windows Vista license

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