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
Dave Mitchell
September 1, 2010 04:28
Re: [perl #77352] Memory leaks in threaded Perl (cloning PVGVs andPL_my_cxt_list)
Message ID:
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


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


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

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About