From af75bcf99d3c05b5b89dfacc1fd346d96b474115 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 29 Jul 2022 10:18:41 +0200 Subject: [PATCH] If there is no LOCK in mmalloc anymore, then there is no need for atfork --- src/xbt/mmalloc/mm_module.c | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/src/xbt/mmalloc/mm_module.c b/src/xbt/mmalloc/mm_module.c index 05d59b1e01..1eca509e64 100644 --- a/src/xbt/mmalloc/mm_module.c +++ b/src/xbt/mmalloc/mm_module.c @@ -1,7 +1,6 @@ /* Initialization for access to a mmap'd malloc managed region. */ -/* Copyright (c) 2012-2022. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2012-2022. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -135,36 +134,6 @@ void *xbt_mheap_destroy(xbt_mheap_t mdp) * Try to increase this first if you experience strange errors under valgrind. */ #define HEAP_OFFSET (128UL<<20) -static void mmalloc_fork_prepare(void) -{ - xbt_mheap_t mdp = NULL; - if ((mdp =__mmalloc_default_mdp)){ - while(mdp){ - mdp = mdp->next_mdesc; - } - } -} - -static void mmalloc_fork_parent(void) -{ - xbt_mheap_t mdp = NULL; - if ((mdp =__mmalloc_default_mdp)){ - while(mdp){ - mdp = mdp->next_mdesc; - } - } -} - -static void mmalloc_fork_child(void) -{ - struct mdesc* mdp = NULL; - if ((mdp =__mmalloc_default_mdp)){ - while(mdp){ - mdp = mdp->next_mdesc; - } - } -} - /* Initialize the default malloc descriptor. * * There is no malloc_postexit() destroying the default mdp, because it would break ldl trying to free its memory @@ -177,10 +146,6 @@ xbt_mheap_t mmalloc_preinit(void) unsigned long mask = ~((unsigned long)mmalloc_pagesize - 1); void* addr = (void*)(((unsigned long)sbrk(0) + HEAP_OFFSET) & mask); __mmalloc_default_mdp = xbt_mheap_new(addr, XBT_MHEAP_OPTION_MEMSET); - - // atfork mandated at least on FreeBSD, or simgrid-mc will fail to fork the verified app - int res = pthread_atfork(mmalloc_fork_prepare, mmalloc_fork_parent, mmalloc_fork_child); - mmalloc_assert(res == 0, "pthread_atfork() failed: return value %d", res); } mmalloc_assert(__mmalloc_default_mdp != NULL, "__mmalloc_default_mdp cannot be NULL"); -- 2.20.1