Revert misguided dlmalloc optimization

This commit is contained in:
Justine Tunney 2024-06-22 09:55:02 -07:00
parent f2c8ddbbe3
commit 388e236360
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
3 changed files with 24 additions and 34 deletions

View file

@ -7,18 +7,24 @@
#if ONLY_MSPACES
static void dlmalloc_pre_fork(void) {
mstate h;
for (unsigned i = 0; i < ARRAYLEN(g_heaps); ++i)
ACQUIRE_LOCK(&g_heaps[i].m.mutex);
if ((h = atomic_load_explicit(&g_heaps[i], memory_order_acquire)))
ACQUIRE_LOCK(&h->mutex);
}
static void dlmalloc_post_fork_parent(void) {
mstate h;
for (unsigned i = 0; i < ARRAYLEN(g_heaps); ++i)
RELEASE_LOCK(&g_heaps[i].m.mutex);
if ((h = atomic_load_explicit(&g_heaps[i], memory_order_acquire)))
RELEASE_LOCK(&h->mutex);
}
static void dlmalloc_post_fork_child(void) {
mstate h;
for (unsigned i = 0; i < ARRAYLEN(g_heaps); ++i)
(void)INITIAL_LOCK(&g_heaps[i].m.mutex);
if ((h = atomic_load_explicit(&g_heaps[i], memory_order_acquire)))
(void)INITIAL_LOCK(&h->mutex);
}
#else