Subj : Linux Posix Threads: Memory consumption To : comp.programming.threads From : saraneus Date : Thu Mar 31 2005 06:04 am Hi folks! I dont speak English very well, I'm from Germany, but I'll try :) I'm programming a server daemon being a chat server application under Linux kernel 2.4.x with GNU C and the Posix Threads library, and I wonder if a thread itself consumes memory being not freed, wenn the thread terminates. For every client's connection there is created a thread to handle it. I was surprised at "top" saying, that all the threads consume more and more memory, even when the threads are terminated - by just returning. To debug it I reduced the code to just create threads and do nothing - the thread's function is empty, so the thread returns very soon. Though, "top" tells me there was more and more memory consumption in the "%MEM" column. That amount of memory stays, even if the threads are returning and only the main thread (and a so called "controlling thread") is still there. I use dynamic memory allocation, but mtrace doesn't find any leak. Is this a normal effect? Do I have to take care of something special? .