massakam opened a new pull request #5246: [Issue #5234][pulsar-client-cpp] Fix 
memory leak caused by deadline_timer holding object reference
URL: https://github.com/apache/pulsar/pull/5246
 
 
   Fixes #5234
   
   ### Motivation
   
   In the C++ client library, memory usage increases as producers are 
repeatedly created and closed. This is because `deadline_timer` such as 
`sendTimer_` holds a reference to the `ProducerImpl` object and the 
`ProducerImpl` destructor is not executed.
   
   
https://github.com/apache/pulsar/blob/822531c072cb608161cef5e9c459ccc5103c9bc0/pulsar-client-cpp/lib/ProducerImpl.cc#L183-L184
   
   `ClientConnection` seems to have the same problem as `ProducerImpl`.
   
   cf. 
https://stackoverflow.com/questions/27065954/boost-deadline-timer-holds-reference-to-object
   
   ### Modifications
   
   The destructor is executed by resetting shared pointers for these 
`deadline_timer` when closing the `ProducerImpl` object.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to