Asio sharedptr heap corruption
Hi, My program uses Asio to connect to a remote server. The connection class make use of sharedptr() as shown below... class Connect:public boost::enable_shared_from_this<Connect> { .... } All the async calls use sharedptr() And the object is created like this... boost::shared_ptr<Connect> Conn=boost::shared_ptr<Connect>(new Connect(IoService)); When the destructor of Conn is called the program crashes with the error... First-chance exception at 0x7c81eb33 in MYPROGRAM.exe: 0x000006D9: There are no more endpoints available from the endpoint mapper. HEAP[MYPROGRAM.exe]: Heap block at 00369710 modified at 00369918 past requested size of 200 Windows has triggered a breakpoint in MYPROGRAM.exe. What could be the reason? (If I avoid using sharedptr() and let it leak the memory, the program does not crash) Please give some hints to come out of this problem... Thanks a lot, Lloyd ______________________________________ Scanned and protected by Email scanner
Lloyd wrote:
class Connect:public boost::enable_shared_from_this<Connect> { .... }
All the async calls use sharedptr() And the object is created like this...
boost::shared_ptr<Connect> Conn=boost::shared_ptr<Connect>(new Connect(IoService));
The bug is most probably elsewhere in your code. Could you post more? Regards, Rutger
participants (2)
-
Lloyd
-
Rutger ter Borg