Subject: [Boost-bugs] [Boost C++ Libraries] #11647: add cleanup expired connections API
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-13 03:04:10
#11647: add cleanup expired connections API
-------------------------------------+----------------------
Reporter: Lutts Cao <lutts.cao@â¦> | Owner: fmhess
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: signals2
Version: Boost 1.59.0 | Severity: Problem
Keywords: |
-------------------------------------+----------------------
when use signals2 with tracked shared object, it will cause memory leak
when the shared track object which is allocated with allocated_shared() or
make_shared() is destructed
another problem is: after the shared track object is destructed,
signals2::connection::connected() will return false, and
signals2::connection::disconnect() will do nothing
according to signals2's code, expired connection cleanup will happen after
operator() is called, and maybe happen when signal.connect() is called.
'''there is a problem when the signal is rarely emited, which means the
time between successive operator() calls is long''
I have tried boost 1.59.0, expired connection cause memory leak is still a
problem.
I suggested to add an explicit cleanup API to signals2::signal class to
let the user cleanup expired connections explicitly
or '''if you think add such an API is not a must, may be you can add a
comment in boost.signals2 document to warn the users that there may be
memory leak.'''
== make_shared() and allocated_shared() in boost ==
document can be found at
http://www.boost.org/doc/libs/1_59_0/libs/smart_ptr/make_shared.html
it is explicitly said these two function templates will use a single
allocation, '''eliminating a significant portion of shared_ptr's
construction overhead. This eliminates one of the major efficiency
complaints about shared_ptr'''
== make_shared() and allocated_shared() in C++11 standard spec ===
in C++11 standard section 20.7.2.2.6.6 at page 573: '''Implementations are
encouraged, but not required, to perform no more than one memory
allocation.'''
== make_shared() and allocated_shared() in Compiler implementations ==
as far as I know, GCC, CLang and Microsoft Visual Studio all use '''single
allocation''
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11647> 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