[Gc] Memory leak in multithreaded application

Christophe Meessen meessen at cppm.in2p3.fr
Tue May 15 13:53:33 PDT 2007


I just checked gc7.0alpha7 which is available to download. My test is ok
except for the CreatThread related leak. Checking the code I saw the the
call to _beginthreadex is missing at the end of GC_win32_start_inner().
I added it but I am not sure if _beginthreadex is called. At least there
is no memory leak anymore. At least the steady increasing one due to

Unfortunately I still see another step wise leak of 300KB. I saw it with
gc6.8 too but only after the server was running for more than an hour.
The client, single threaded, doesn't show this. Memory usage is all flat.

With gc7.0a7 I saw it once after a few minute run. Appart from this,
memory usage is flat and normal. I then tried a second run and it didn't
show up so far, but I'll have to stop and continue testing tomorrow.

Its difficult to trace. Could it be a race condition in GC thread
handling ?

My server code is only two threads. One is waiting for connection and
launch a new thread to handle incomming connections. This thread has
then some memory allocation, do a few byte exchange on the conncetion
than close everything. I currently run only one client. Since
transaction is short I have many connection and thread creations per

More information about the Gc mailing list