discuss-gnustep
[Top][All Lists]
Advanced

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

Re: libobjc threads leak?


From: Andrew Pinski
Subject: Re: libobjc threads leak?
Date: Wed, 9 Feb 2005 01:53:47 -0500


On Feb 8, 2005, at 10:34 PM, Larry Campbell wrote:

I just switched from gcc 2.95.x, where the GNUstep dox say I must use gnustep-objc, to gcc 3.3 where they say the built-in libobjc works fine. But it doesn't. It leaks threads, so eventually your program crashes in objc_detach_thread. The reason is that in gcc's libobjc, threads are created joinable, so when they exit they hang around forever waiting to be joined.

In gthr-posix.h:

  if (!(pthread_create (&new_thread_handle, NULL, (void *) func, arg)))

the second argument to pthread_create is NULL, which means default attributes, which on linux 2.4 I believe means the threads are joinable, not detached. Now it looks like someone thought about this a bit because in the same gthr-posix.h there is a variable called _objc_thread_attribs initialized thusly:


Please file a bug in gcc's bugzilla since this is not a GNUStep bug but a libobjc one
and libobjc is part of gcc.
I will look into this when I become sober.


-- Pinski
A libobjc maintainer





reply via email to

[Prev in Thread] Current Thread [Next in Thread]