This is the mail archive of the
mailing list for the glibc project.
Re: malloc patch for 2.2.4
> 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,
I know. But this is truely useless, we should attempt to allow this,
other systems have implemented this as well. Anyway, this is a
> and the libc documentation doesn't mention that all
> subsystems are locked across a fork().
Nevertheless we (rightly) try to achieve this as far as possible,
malloc and stdio mutexes are locked across 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?
Doesn't matter, I don't use atexit() functions -- but, most important,
for my test case the mysterious crashes happen in the _parent_
multi-threaded application, not in the forked child.