MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / jemalloc_postfork_parent

Function jemalloc_postfork_parent

deps/jemalloc/src/jemalloc.c:3854–3891  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3852
3853#ifndef JEMALLOC_MUTEX_INIT_CB
3854void
3855jemalloc_postfork_parent(void)
3856#else
3857JEMALLOC_EXPORT void
3858_malloc_postfork(void)
3859#endif
3860{
3861 tsd_t *tsd;
3862 unsigned i, narenas;
3863
3864#ifdef JEMALLOC_MUTEX_INIT_CB
3865 if (!malloc_initialized()) {
3866 return;
3867 }
3868#endif
3869 assert(malloc_initialized());
3870
3871 tsd = tsd_fetch();
3872
3873 tsd_postfork_parent(tsd);
3874
3875 witness_postfork_parent(tsd_witness_tsdp_get(tsd));
3876 /* Release all mutexes, now that fork() has completed. */
3877 for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
3878 arena_t *arena;
3879
3880 if ((arena = arena_get(tsd_tsdn(tsd), i, false)) != NULL) {
3881 arena_postfork_parent(tsd_tsdn(tsd), arena);
3882 }
3883 }
3884 prof_postfork_parent(tsd_tsdn(tsd));
3885 if (have_background_thread) {
3886 background_thread_postfork_parent(tsd_tsdn(tsd));
3887 }
3888 malloc_mutex_postfork_parent(tsd_tsdn(tsd), &arenas_lock);
3889 tcache_postfork_parent(tsd_tsdn(tsd));
3890 ctl_postfork_parent(tsd_tsdn(tsd));
3891}
3892
3893void
3894jemalloc_postfork_child(void) {

Callers 1

zone_force_unlockFunction · 0.70

Calls 13

tsd_postfork_parentFunction · 0.85
malloc_initializedFunction · 0.70
witness_postfork_parentFunction · 0.70
narenas_total_getFunction · 0.70
arena_postfork_parentFunction · 0.70
prof_postfork_parentFunction · 0.70
tcache_postfork_parentFunction · 0.70
ctl_postfork_parentFunction · 0.70
tsd_fetchFunction · 0.50
arena_getFunction · 0.50

Tested by

no test coverage detected