Page 1 of 1

C++ API cannot release resource

Posted: 29 Jul 2014, 08:51
by seeingrain
Description:
Call the below code for about 120 times, the system resource used up:
lg_ptrSmartFox=boost::shared_ptr<SmartFox> (new SmartFox());
lg_ptrSmartFox->Version();

Why I create the SmartFox instance for so many times? --- Because when a connection attempt failed or lost, I will automatically create a new SmartFox instance and reconnect to server.
I noticed, after calling lg_ptrSmartFox->Version(), the use_count increased to 8, and never decrease, the old SmartFox instance cannot be destroyed even giving a new SmartFox pointer. I investigated the source code of C++ API, it seems because of "shared_from_this()" calling inside of SmartFox.

Question:
How to release old SmartFox instance to avoid system resource used up?

Re: C++ API cannot release resource

Posted: 20 Aug 2014, 09:14
by Bax
Sorry for tho late reply.
We are implementing a method to dispose the SmartFox instance. It will be available in the next version.