ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
Re: [boost] Re: Boost.Thread : Memory leakage with thread local storage?
by Roland other posts by this author
Jan 21 2004 7:51AM messages near this date
[boost] Re: Boost.Thread : Memory leakage with thread local storage? | [boost] Re: Boost.Thread : Memory leakage with thread local storage?
(Michael Glassford <glassfordm@[...].com> ) wrote:

>  
>  First of all, if I understand correctly, in your example you put the
>  _CrtDumpMemoryLeaks() call too early: since it simply lists all blocks
>  that are allocated at the time when it is called, it should normally
>  be called at a point where all memory ought to have been freed; so the
>  beginning of the main() function seems to be the wrong place for it. A
>  better way would be the end of main() (though this is still too early
>  in that static objects haven't been destroyed and released their
>  memory yet); perhaps even better is to call
>  
>      CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF |
>  _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
>  
>  which sets a flag telling the memory allocator to check for leaks on
>  exit. However, even with these methods I still see "leaks" reported. I
>  have yet to determine which of them are real problems and which are
>  valid behavior, but will look into it.

Thanks, I think I have figured this out also in the meantime. To tell the whole story:
I discovered the "leakage" while compiling a MFC program. There you
don't need to do this explicitely.

But I found the following discussion on
microsoft.public.vc.language: Memory leaks in DLL

http://groups.google.at/groups?q=Memory+leaks+in+DLL&hl=de&lr=&ie=UTF-8&oe=UTF-8&selm=ebjezu
Kp%24GA.315%40cppssbbsa04&rnum=2

As I understand this, it has to do with MFC's handling of Leakage reporting.
However I am still not sure what really is going on, but I think my false "leakage"
isn't caused by boost.thread. I was able to track down the offending
allocation to the locale handling of the iostream library, which happens
to be used in "once".

So I think all that can be done in the moment is to remeber this, in case
anyone else discovers the "leakage".

BTW.: After having applied your suggested setting of the DbgFlag
my example does not report leakage any more. (Do I have a more
recent SP?)

Roland


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Roland
Michael Glassford
Michael Glassford
Roland
Michael Glassford

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved