-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
This bug was already present and pointed out in the old PR (ros/ros_comm#1414).
As far as I can see it is still present in this version.
Copy&paste from old PR:
There is a memory leak in Snapshotter::subscribe.
You are binding topicCB using boost::bind with queue as additional parameter.
Therefore the subscriber holds a shared_ptr to the queue.
Storing the subscriber inside the queue (queue->setSubscriber(sub);) essentially makes the queue hold a shared_ptr to itself and thus it will never be deleted.
Never deleting the subscriber will in turn stop a whole bunch of ros internals from getting shutdown properly.
A possible fix (albeit not a very nice one) is.
Snapshotter::~Snapshotter()
{
for (std::pair<const std::string, boost::shared_ptr<MessageQueue>>& buffer : buffers_)
{
buffer.second->sub_->shutdown();
}
}
Metadata
Metadata
Assignees
Labels
No labels