dead lock in forked child

Jason Evans jasone at
Tue Oct 9 18:07:05 PDT 2012

On Oct 9, 2012, at 5:53 PM, "Mowry, Robert" <Robert.Mowry at> wrote:
> I can understand the motivation behind wanting this to work, but when I
> read the POSIX spec for threaded programs that call fork(), it seems
> pretty clear that malloc() and free() etc are not defined to be safe to
> call in the child process:
> […]
> Is is that people want to go beyond what the spec calls out - and hence
> the request to fix issues like this?  Or are folks not aware they are
> attempting to do something that's not really kosher?

In an idea world I would prefer to make no accommodation for such dangerous application behavior.  However, I've heard many times, "But it works with [insert OS/allocator here]!"  Thus, the problem is that there's a lot of dangerous code in the world that mostly works, and if jemalloc doesn't go to some extra trouble, it ends up not being a viable general purpose alternative.

That said, I tend to play whack-a-mole with fork-related issues, because I personally don't think it's important enough to spend a bunch of time providing a rock-solid solution. =)


More information about the jemalloc-discuss mailing list