Boost logo

Boost Users :

From: Stefan Shishkov (stefan_at_[hidden])
Date: 2004-11-23 05:24:12


Hi,

a note regarding the memory leak (8+24 bytes) that you found - see bellow.

----- Original Message -----
From: "Roland Schwarz" <roland.schwarz_at_[hidden]>
Newsgroups: gmane.comp.lib.boost.user
Sent: Tuesday, November 23, 2004 12:32 AM
Subject: Re: Re: Re: Re: Leak when using boost threads underVC .NET using
usi ng statically linked CRT

...

> MSVC prints out some messages about the memory leak when ending the
program.
> Usually they are helpful in tracking down the leak. (At least they give
> a first hint.)
>
> As I have seen you are still using 1.30 of boost. I would recommend to
> upgrade to 1.32 (if possible).
> In 1.32 the ability to statically linking to your code has been
> reintroduced.
> At least you could try your threading example with this version.
>
> I did this right now but constrained the loop to 1000 iterations.
> I used:
> #define CRTDBG_MAP_ALLOC
> #include <stdlib.h>
> #include <crtdbg.h>
>
> at the top of the file
> and
> _CrtDumpMemoryLeaks();
> at the bottom.
>
> Independent of the loop size I get a constant leak of 24 + 8 bytes.:
> Detected memory leaks!
> Dumping objects ->
> {89} normal block at 0x002F27A8, 24 bytes long.
> Data: < w > C0 09 FD 77 FF FF FF FF 00 00 00 00 00 00 00 00
> {88} normal block at 0x002F2A18, 8 bytes long.
> Data: < '/ > A8 27 2F 00 01 CD CD CD
> Object dump complete.
>
> I am not sure where this comes from at he moment, since I think the tls
> is not even used
> internally yet (the once function might be the culprit, but I don't
> think it is used in your example.)
>
> At least the leak seem to be constant.

I have a similar leak on Windows with the dll version of boost threads 1.32.
Perhaps this is the same leak reported by gast128 in the thread "Memory leak
reported using threads library". A mutex is created in DLLMain ->
on_process_enter -> init_threadmon_mutex. It seems that this mutex is never
deleted and there is no comments that this is intentional. On Windows the
size of the mutex is 8 bytes and it creates a CRITICAL_SECTION in its
constructor - 24 bytes.
....

> Roland

Best regards
Stefan


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