Boost logo

Boost :

From: (noreply_at_[hidden])
Date: 2006-03-23 14:27:18

Bugs item #1457205, was opened at 2006-03-23 19:27
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: smart_ptr
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Vladislav Lazarenko (vlazarenko)
Assigned to: Peter Dimov (pdimov)
Summary: shared_ptr<> causes memory leacks and crash

Initial Comment:
I have written this small test to reproduce the bug.
Please see..

#include <cstddef>
#include <boost/shared_ptr.hpp>
#include <boost/test/unit_test.hpp>

using namespace std;
using namespace boost;
using namespace boost::unit_test_framework;

  class A;

  class B
    B(boost::shared_ptr<A> ptr) : ptr_(ptr) {}
    ~B() {}

    boost::shared_ptr<A> ptr_;

  class A
    A(int value) : value_(value) {}
    ~A() {}

    int value_;

void test_shared_ptr()
  BOOST_CHECKPOINT("Testing shared pointer...");

  shared_ptr<A> a1(new A(10));

    shared_ptr<B> b1 = a1->create();

    shared_ptr<B> b1 = a1->create();


You can respond by visiting:

This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
Boost-bugs mailing list

Boost list run by bdawes at, gregod at, cpdaniel at, john at