|
Boost : |
From: martin.ecker_at_[hidden]
Date: 2004-05-06 05:03:15
Jeff,
> Although, I am having problems with my
> VC71 MFC application reporting memory
> leaks of a 24byte block corresponding
> to each shared_ptr loaded from an
> oarchive.
You probably mean "loaded from an iarchive".
Anyway, due to the modifications I've made in
our local code base of boost::serialization
I had a bit of a look through the code.
I'm not sure, but the memory leaks you experience
could possibly be related to the fact that
basic_iarchive::delete_created_pointers is never
called.
Maybe you can add a call to this function yourself
somewhere in your application (delete_created_pointers
is a public member function of basic_iarchive)
and see if the memory leaks disappear.
Note that this is just a guess on my part,
as I haven't had time to look at all the code
in detail.
In reference to the example you posted, you
could change it to not use an empty shared_ptr
but actually allocate an object for it
and then change the deserialization code to:
if( lIn.good() )
{
boost::archive::xml_iarchive ia( lIn );
ia & boost::serialization::make_nvp( "SomeClass", lSomeClass );
ia.delete_created_pointers();
}
Regards,
Martin
TAB Austria
Industrie- und Unterhaltungselektronik GmbH & CoKG
http://www.tab.at
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk