Boost logo

Boost Users :

From: zzp good (baobeileaf_at_[hidden])
Date: 2007-10-29 04:49:07


hi, guys, I found memory leak using the following code:

#include <boost\array.hpp>
#include <boost\shared_ptr.hpp>
using namespace boost;

class C
{
public:
    shared_ptr<C> pNext;
};

void test()
{
    shared_ptr<C> c0(new C());
    shared_ptr<C> c1(new C());
    c0 -> pNext = c1;
    c1 -> pNext = c0;
}

void main()
{
    test();

    _CrtDumpMemoryLeaks();
}

when running with F5, it said:

Detected memory leaks!
Dumping objects ->
d:\program files\microsoft visual studio 8\vc\include\crtdbg.h(1147) : {126}
normal block at 0x003A64B0, 16 bytes long.
 Data: < E hd: > C4 17 45 00 01 00 00 00 01 00 00 00 68 64 3A 00
d:\program files\microsoft visual studio 8\vc\include\crtdbg.h(1147) : {125}
normal block at 0x003A6468, 8 bytes long.
 Data: < c: d: > D0 63 3A 00 18 64 3A 00
d:\program files\microsoft visual studio 8\vc\include\crtdbg.h(1147) : {124}
normal block at 0x003A6418, 16 bytes long.
 Data: < E c: > C4 17 45 00 01 00 00 00 01 00 00 00 D0 63 3A 00
d:\program files\microsoft visual studio 8\vc\include\crtdbg.h(1147) : {123}
normal block at 0x003A63D0, 8 bytes long.
 Data: <hd: d: > 68 64 3A 00 B0 64 3A 00
Object dump complete.

Any body have an idea about this? Thanks very much.



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