[Gc] Memory leak in multithreaded application

Boehm, Hans hans.boehm at hp.com
Fri May 11 10:00:25 PDT 2007


What's the GC version and platform?

If the memory usage keeps increasing roughly linearly, I would suspect a
leak somewhere.  It would be good to understand whether the GC heap or
something else is growing.  This is usually easy to determine by running
with GC_PRINT_STATS set.  GC7 will also tell you the amount of reachable
memory at each collection.

If this is on Windows, and the problem is not primarily the GC heap, my
top guess would be a leak of thread resources in win32_threads.c.  There
should probably be a test case that starts lots of threads in a loop ...

Presumably there is some idle time, so the threads get a chance to shut
down?  How many threads does the OS think are alive?

Hans 

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Christophe Meessen
> Sent: Thursday, May 10, 2007 11:58 PM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] Memory leak in multithreaded application
> 
> Hello,
> 
> I've tested libgc with my client-server application. The 
> single threaded client works ok without any memory leak.
> 
> The multithreaded server application shows a significant 
> steady step wise memory usage increase that looks like a memory leak.
> 
> The server starts a thread for any incomming connection, 
> allocate some buffers and do some IO operations. The it 
> closes the connection and the thread stops. Some threads 
> start and stop very quickly before any memory allocation are 
> done. I call these transactions. After each transaction all 
> objects are dereferenced so memory usage should be stable on 
> the average.
> 
> When I let it run, I see steady memory usage, and after a few 
> tens of transactions the memory usage grows by chuck of 5MB. 
> Then again it runs for 30sec to a minute, and a new chuck is 
> added. The chunck can be up to  10 MB.
> 
> Is this a normal behaviour with gc or is there a memory leak ?
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> 



More information about the Gc mailing list