Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] Potential memory leak with thread_specific_ptr
From: Chris Newbold (Chris.Newbold_at_[hidden])
Date: 2012-09-10 14:08:27


> From: threads-devel-bounces_at_[hidden] [mailto:threads-devel-
> bounces_at_[hidden]] On Behalf Of Vicente J. Botet Escriba
> Sent: Monday, September 10, 2012 2:06 PM

> > void set_tss_data(void const* key,
> > boost::shared_ptr<tss_cleanup_function> func,
> > void* tss_data,bool cleanup_existing)
> > {
> > if(tss_data_node* const current_node=find_tss_data(key))
> > {
> > if(cleanup_existing && current_node->func && (current_node-
> >value!=0))
> > {
> > (*current_node->func)(current_node->value);
> > }
> > if(func || (tss_data!=0))
> > {
> > current_node->func=func;
> > current_node->value=tss_data;
> > }
> > else
> > {
> > erase_tss_node(key);
> > }
> > }
> > else
> > {
> > add_new_tss_node(key,func,tss_data); // <<<<<< LEAK OCCURS
> HERE!
> > }
> > }
> >
> > Though the implementation of set_tss_data in win32/thread.cpp is
> > structured somewhat differently, I believe it suffers the same problem

> thanks for catching this issue. Please could you add a ticket so that the issue
> is not lost?

Done: https://svn.boost.org/trac/boost/ticket/7360

-Chris


Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk