|
From: | Richard Frith-Macdonald |
Subject: | Re: Gnustep-base thread creation bug. |
Date: | Mon, 30 Apr 2007 06:16:00 +0100 |
On 27 Apr 2007, at 22:56, Chris Ball wrote:
Right now there appears to be a slightly subtle bug in thr-pthread.m.Specifically the threads created here are created as joinable threads, this isbad because joinable threads have to be joined before their memory isreleased. What we really want here are detached threads that just go away whenthey are done executing.This is trivial to test, create a program that spawns threads that do nothing but exit and watch as the memory usage explodes as the thread count grows (I manage around 300 threads before a cryptic message that actually means ENOMEMturns up).
I think thr-pthread.m is used only on OpenBSD systems, and I don't have one to test on.
I've changed the code to use _objc_thread_attribs to set the thread as not joinable in subversion trunk, and I would be grateful if you could test this and let me know if it's ok (if it is, I'll backport it to the stable branch).
Looking at the code in the objc runtime library, it seems like that would heave exactly the same problem with libpthread and thr-pthread.c Do you know if that's the case? If so, do you know if it has been reported to the gcc maintainters?
[Prev in Thread] | Current Thread | [Next in Thread] |