Boost logo

Boost :

Subject: [boost] [Serialization] memory leak when serialising a map containing shared_ptrs
From: richard bradley (ricbrad_at_[hidden])
Date: 2010-01-26 12:50:05


I'm finding that Boost.Serialization is leaking memory when deserialising
std::map<string,boost::shared_ptr<X>>.
Maybe this is a sign that my data structures are too complicated? ;-)
This wouldn't bother me that much, except that I'm also using Boost.Test,
which gives lots of angry messages about leaked memory at the end of my
tests (I'm using MSCRT).
I've attached a simple test case which demonstrates this.
Can anyone shed some light on what's going on here? Have I used any of the
libraries incorrectly? Is there anything I can do to fix this?
I'm using Visual Studio 2008, and boost 1.41.0
The output from the attached test looks like:
===========
Running 1 test case...
MyClass @3532504 with 1 children

MyClass @3532960 with 1 children
Detected memory leaks!
Dumping objects ->
{800} normal block at 0x0035EDE8, 1 bytes long.
 Data: < > CD
Object dump complete.
===========

I've also attached a stack trace which I got by breaking on the non-free'd
memory allocation,using "--detect_memory_leak=800"
Thanks very much,
Rich





Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk