On Fri, Mar 16, 2007 at 08:22:59AM -0700, Jerry D. Hedden wrote: > Using threads inside CHECK or INIT blocks causes leaked scalars: > > > perl -Mthreads -e 'CHECK { threads->create(sub {})->join; }' > Scalars leaked: 1 > > What is the scalar that is leaking? It's the cloned copy of the CHECK CV. It's cloned because the anon sub has a weak reference to it, but has a refcnt of zero due to that weak reference. It also exists on the savestack (having just been shifted off PL_checkav in Perl_call_list), but that's not cloned. > Can this be fixed? Dunno. There was another problem with items only on the savestack leaking, and Nicholas suggested a fix that I need to get me head round one day. -- The optimist believes that he lives in the best of all possible worlds. As does the pessimist.Thread Previous