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

Re: [perl #40416] threads creation memory leak

Thread Previous | Thread Next
From:
Jerry Hedden
Date:
September 26, 2006 13:37
Subject:
Re: [perl #40416] threads creation memory leak
Message ID:
20060926203643.55287.qmail@web30208.mail.mud.yahoo.com
Santeri Paavolainen reported:
> ==13941== 35,456 bytes in 3,738 blocks are definitely lost in loss
> record 9 of 9
> ==13941==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
> ==13941==    by 0x80CED9B: Perl_safesysmalloc (util.c:78)
> ==13941==    by 0x80D0694: Perl_savepv (util.c:765)
> ==13941==    by 0x810DC2A: Perl_sv_dup (sv.c:10293)
> ==13941==    by 0x810B538: Perl_gp_dup (sv.c:9721)
> ==13941==    by 0x810CFE9: Perl_sv_dup (sv.c:10181)
> ==13941==    by 0x80E089D: Perl_he_dup (hv.c:156)
> ==13941==    by 0x810DB59: Perl_sv_dup (sv.c:10281)
> ==13941==    by 0x810CF87: Perl_sv_dup (sv.c:10179)
> ==13941==    by 0x8110D1F: perl_clone (sv.c:11074)
> ==13941==    by 0x400BB7A: Perl_ithread_create (threads.xs:438)
> ==13941==    by 0x400C647: XS_threads_new (threads.xs:698)

Running through the stack trace we have:
==13941==    by 0x400BB7A: Perl_ithread_create (threads.xs:438)
	thread->interp = perl_clone(aTHX, CLONEf_KEEP_PTR_TABLE);

==13941==    by 0x8110D1F: perl_clone (sv.c:11074)
    PL_envgv		= gv_dup(proto_perl->Ienvgv, param);

==13941==    by 0x810CF87: Perl_sv_dup (sv.c:10179)
    	GvSTASH(dstr)	= hv_dup_inc(GvSTASH(sstr), param);

==13941==    by 0x810DB59: Perl_sv_dup (sv.c:10281)
		HvARRAY(dstr)[i]
			= source ? he_dup(source, sharekeys, param) : 0;

Am I correct in interpreting this to mean that the leak is caused by 
one of the keys in the stash associated with %ENV that is duplicated in
the Perl interpreter for the thread?  (I really have no idea what I
just said.)

In perl_destruct, we have:
    PL_envgv = Nullgv;
which indicates that %ENV is being freed when the thread terminates. 
So what is it about the leaked item that keeps it hanging around after
the thread is destroyed?

The code looks very different in blead.  Does that indicate that this
problem may have been fixed already?

(If I'm not being helpful, then please just ignore me.)


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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