diff --git a/memory/build/mozjemalloc.cpp b/memory/build/mozjemalloc.cpp index 58a92cd457ee..afcb663d182f 100644 --- a/memory/build/mozjemalloc.cpp +++ b/memory/build/mozjemalloc.cpp @@ -5216,6 +5216,9 @@ void _malloc_postfork_parent(void) MOZ_NO_THREAD_SAFETY_ANALYSIS { FORK_HOOK void _malloc_postfork_child(void) { + // Do this before iterating over the arenas. + gArenas.PostForkFixMainThread(); + // Reinitialize all mutexes, now that fork() has completed. huge_mtx.Init(); @@ -5225,7 +5228,6 @@ void _malloc_postfork_child(void) { arena->mLock.Reinit(gForkingThread); } - gArenas.PostForkFixMainThread(); gArenas.mLock.Init(); } #endif // XP_WIN