Re: [Boost-bugs] [Boost C++ Libraries] #11638: stored weak_ptr of track object will prevent the track object memory being freed

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11638: stored weak_ptr of track object will prevent the track object memory being freed
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-10 17:24:51


#11638: stored weak_ptr of track object will prevent the track object memory being
freed
-------------------------------------+-------------------------------------
  Reporter: Lutts Cao | Owner: fmhess
  <lutts.cao@…> | Status: closed
      Type: Bugs | Component: signals2
 Milestone: To Be Determined | Severity: Problem
   Version: Boost 1.56.0 | Keywords: signals2 weak_ptr
Resolution: invalid | memory leak
-------------------------------------+-------------------------------------
Changes (by fmhess):

 * status: new => closed
 * resolution: => invalid

Comment:

 You may be happier with signals2 from boost 1.59. It deletes slot objects
 inside the signal (and their tracked weak_ptrs) ASAP after slot
 disconnection, rather than putting it off for the signal to garbage
 collect at some later point.

 While weak_ptr causing a delay in the deallocation of memory for
 shared_ptr created with allocate_shared is interesting, it is an issue
 with allocate_shared, not signals2. My guess is allocate_shared allocates
 a single block of memory to contain both the pointed-at object and the
 shared reference count, in order to minimize the number of memory
 allocations. Thus the memory cannot be freed until both the pointed-at
 object and the shared reference count are destroyed. Since the weak_ptr
 has a handle to the shared reference count, it delays the deallocation.

 I'm closing this ticket, if there is still a need for an added cleanup API
 when using signals2 from 1.59, please open a separate ticket for that
 feature request.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11638#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC