Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-04-21 21:56:41


In the experiment you conducted, I would expect to see memory leaks. I
can't explain why you didn't find this.

You might be interested to know that this issue has just arisen for me in a
surprising but still predictable way.

The serialization demo examples demonstrate the serialization of raw
pointers. I didn't use shared pointers because I didn't want to confuse the
reader with another layer. I took pains to delete created pointers so that
everything ran clean. Recently, the test system has been upgraded to detect
memory leaks by default when using VC 7.1. And guess what - memory leaks.
And worse, very obvious in retrospect. These tutorial examples have been in
use for a year an a half and these leaks were never noticed. There is an
object lesson here.

I'm in a little bit of a quandry regarding my tutorial. Its not obvious how
to fix the leaks without making the example obscure.

No real point here, just thought someone might enjoy it

Robert Ramey

kauai wrote:
> Hi folks,
>
> When I unserialize an object that has pointers in it
> (composite recursive structure), does boost
> unserialize take care of allocating them on the heap?
> I assume it does, however...
>
> I run a memory profiling tool call 'valgrind' and I on
> purpose decided not to cleanup my newly created
> serialized object. What happened after running
> through valgrind surprised me, it reported no memory
> leaks. Whats the magic here, smart pointers?
>
> Thanks for any help,
> Kauai
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com


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