Boost logo

Boost :

Subject: Re: [boost] memory leak
From: Lars Viklund (zao_at_[hidden])
Date: 2011-07-14 09:29:46


On Wed, Jul 13, 2011 at 05:44:03PM +0200, Aleksa Karalejic wrote:
> Hi there,
> Today I have noticed memory leak in thread library -
> Memory leak test is pure:
>
> #include <boost/thread.hpp>
> int main()
> {
> _CrtDumpMemoryLeaks();
> }

That function only reports unfreed blocks. You're checking the state of
the runtime memory in the middle of the program, while there is a lot of
code that hasn't run yet (destructors of locals in main, destructors of
objects with static storage duration, DLL detach procedures, etc.).

The documentation for the function incidentally tells you how to use
_CrtSetDbgFlag with CRTDBG_LEAK_CHECK_DF to invoke CrtDumpMemoryLeaks as
late in the process termination as possible, to avoid any false
positives.

As they say, "it's not over until the fat lady sings."
What you detect are not leaks, but most probably just resources not
freed yet.

-- 
Lars Viklund | zao_at_[hidden]

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