tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Possible pthreads memory leak



mm_lists%pulsar-zone.net@localhost (Matthew Mondor) writes:

>mlelstv%serpens.de@localhost (Michael van Elst) wrote:
>> and the pullup to netbsd-5 branch occured 6 days ago...

>ident(1) shows that I have 1.106.2.2, so my tests were done with the
>fix applied.  This probably explains the more serious leaks Zach
>experiences on 5.0.1.  Is it still expected that without inserting a
>syscall to cause a context switch a small leak still occurs over time
>with the fix?

The pthread library doesn't free the thread stack when a thread
exits but reuses it when creating a new thread. Due to a race
condition with the kernel, the "reuse" may fail. However, this
loss should not grow beyond a limit set by the concurrency of the
system.

So no, there shouldn't be a constant memory leak. A -current/amd64
system shows a growth from 14M to 22M but then seems to be stable,
which means that it lost memory for 4 threads (with 2M stack each).


Greetings,
-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index