This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: GCJ built multithreaded program keeps creating zombies
- From: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gcc-bugs at gcc dot gnu dot org, <aeby at graeff dot com>
- Date: Thu, 19 Dec 2002 18:12:00 -0600 (CST)
- Subject: Re: GCJ built multithreaded program keeps creating zombies
> Wolfgang> Then on Linux you will create a zombie for every thread you
> Wolfgang> create.
>
> But empirically this doesn't happen, because we create non-joinable
> threads. In fact if we tried to join them, pthread_join would just
> return an error (unless Linux egregiously violates POSIX or X/OPEN
> here).
OK, that's exactly what the man-page of pthread_join also describes.
So no memory leak and no zombies. Thanks for the non-joinable bit.
> Wolfgang> Unfortunately, I can't find the place where you actually
> Wolfgang> create a new thread right away...
>
> _Jv_ThreadStart in libjava/posix-threads.cc.
I saw one other thing, but this is arguable: I have had cases where
pthread_create returned with an error, but the error code was EAGAIN. This
is, well, a somehow funny error code, since simply retrying usually helps.
So the typical loop looks like
int r;
do {
r = pthread_create (...);
} while (r == EAGAIN);
I don't know what the Java specs say, though.
Regards
Wolfgang
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ticam.utexas.edu
www: http://www.ticam.utexas.edu/~bangerth