Boost logo

Boost Users :

Subject: [Boost-users] [boost::shared_ptr] Memory is not freed
From: Panagiotis Foteinos (pafotein_at_[hidden])
Date: 2011-03-27 18:57:31


Hello users.

In the past, I wrote a program using the C++ built-in pointers. I made sure
that there was not any memory leak: indeed, valgrind reported no memory
leaks. I decided to switch to boost::shared_ptr, and replaced all the C++
built-in pointers with boost:shared_ptr ones. Interestingly, valgrind now
reports a huge memory leak. I thought that by just replacing the built-in
pointers with the boost::shared_ptr pointers (forgetting about explicit
deletes of memory) would be enough. Note that I use boost::make_shared<> for
memory allocations.

I wish I could include the code in this email, but it is very long and
complicated. Therefore, I am kindly asking you to guess what might have been
wrong with the boost:shared_ptr. Could you think of any scenarios that would
cause the observed bahavior?

Any ideas would be welcome.

OS: Ubuntu 64
Compiler: gcc version 4.4.3

Best Regards,
Panagiotis Foteinos



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