This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]