-
Mike Hommey authored
Bug 1399921 - Register zone allocator independently, and delay jemalloc initialization on mac. r=njn In bug 1361258, we unified the initialization sequence on mac, and chose to make the zone registration happen after jemalloc initialization. The order between jemalloc init and zone registration shouldn't actually matter, because jemalloc initializes the first time the allocator is actually used. On the other hand, in some build setups (e.g. with light optimization), the initialization of the thread_arena thread local variable can happen after the forced jemalloc initialization because of the order the corresponding static initializers run. In some levels of optimization, the thread_arena initializer resets the value the jemalloc initialization has set, which subsequently makes choose_arena() return a bogus value (or hit an assertion in ThreadLocal.h on debug builds). So instead of initializing jemalloc from a static initializer, which then registers the zone, we instead register the zone and let jemalloc initialize itself when used, which increases the chances of the thread_arena initializer running first. --HG-- extra : rebase_source : 4d9a5340d097ac8528dc4aaaf0c05bbef40b59bb
078c8d18