This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: malloc patch for 2.2.4
Wolfram Gloger <Wolfram.Gloger@dent.med.uni-muenchen.de> writes:
> > Do you use threads? In this case, this is not surprising. fork()
> > does not work well with threads and may result in odd behavior.
>
> Huh? POSIX has a well-defined fork() even with threads. My test case
>
> http://www.malloc.de/tests/fork-malloc.c
>
> is conforming AFAICT.
free() and exit() are not atomic operations and may not be called
after a fork() in the newly-created child process.---At least SUSv2
says so, and the libc documentation doesn't mention that all
subsystems are locked across a fork().
> Anyway, the problem occurs even if the fork()ed child does just an
> exit(0)!
exit() invokes all functions registered via atexit(). It is not very
surprising that this doesn't work. Have you tried _exit() instead?
--
Florian Weimer Florian.Weimer@RUS.Uni-Stuttgart.DE
University of Stuttgart http://cert.uni-stuttgart.de/
RUS-CERT +49-711-685-5973/fax +49-711-685-5898