[PATCH 1/2] Move zone registration to zone.c

Mike Hommey mh+jemalloc at glandium.org
Mon Apr 2 00:03:27 PDT 2012


On Fri, Mar 30, 2012 at 08:06:26PM +0200, Mike Hommey wrote:
> On Fri, Mar 30, 2012 at 08:03:52PM +0200, Mike Hommey wrote:
> > On Fri, Mar 30, 2012 at 10:54:36AM -0700, Jason Evans wrote:
> > > On Mar 27, 2012, at 5:46 AM, Mike Hommey wrote:
> > > > On Tue, Mar 27, 2012 at 02:20:12PM +0200, Mike Hommey wrote:
> > > >> @@ -743,8 +723,8 @@ void
> > > >> jemalloc_darwin_init(void)
> > > >> {
> > > >> 
> > > >> -	if (malloc_init_hard())
> > > >> -		abort();
> > > >> +	if (!malloc_init_hard())
> > > >> +		register_zone();
> > > >> }
> > > >> #endif
> > > > 
> > > > Please note that I first attempted to move this function too, and do
> > > > lazy initialization of jemalloc, but that ends up in a dead lock because
> > > > pthread_atfork calls malloc.
> > > 
> > > Now that pthread_atfork() isn't being called on Darwin, does deadlock
> > > still occur due to some other memory allocation during initialization?
> > 
> > I haven't experienced deadlocks during initialization, even when
> > pthread_atfork was called.
> 
> D'oh, I did. End of week confusion. Mmm I'll have to check. I guess it
> could work, now.

And it does. Patch incoming.

Mike



More information about the jemalloc-discuss mailing list