4e2e3dd Fix fork-related bugs.

Mike Hommey mh+jemalloc at glandium.org
Tue Mar 20 09:50:06 PDT 2012

On Mon, Mar 19, 2012 at 07:02:48AM -0700, Jason Evans wrote:
> On Mar 19, 2012, at 4:57 AM, Mike Hommey wrote:
> > This commit broke building on OSX, because jemalloc_postfork, used
> > in zone.c, isn't there anymore.
> Thanks for the heads up on this and the __thread regression.  Clearly
> it's time for me to add support for Lion so that I can start testing
> on OS X again. =)

Since I looked at the OSX libc source, I have some additional
information about force_lock and force_unlock in the introspection
struct. As it turns out, these functions are called before and after
forking, so they actually have the exact role of jemalloc_prefork and
jemalloc_postfork. But now that postfork has a different code for parent
and child, and since there is no such distinction in the zone allocator,
I guess what should happen is for jemalloc to check if the pid of the
process in postfork is the same as the one it saw during prefork, and
dispatch to postfork_child or postfork_parent accordingly.




More information about the jemalloc-discuss mailing list