Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] Memory leaks even with shared_ptrs
From: Maxime van Noppen (maxime_at_[hidden])
Date: 2011-07-21 10:15:59


On 07/21/2011 04:02 PM, cc caprani wrote:
> int main()
> {
[...]
> std::cin.get(); // hold console window open
> _CrtDumpMemoryLeaks(); // report memory leaks
> }

Hi,

I don't know how _CrtDumpMemoryLeaks() works, but at the call point
nothing has been deleted yet as nothing went out of scope.

Try putting what is in your main() currently into another scope, for
example:

int main()
{
   {
     // ... all your code ...
   }

   // Now that we exited the previous scope, everything should've
   // been deleted...

   std::cin.get();
   _CrtDumpMemoryLeaks();
}

-- 
Maxime

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