Boost logo

Boost Users :

Subject: [Boost-users] Asio sharedptr heap corruption
From: Lloyd (lloyd_at_[hidden])
Date: 2010-02-12 09:28:48


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net