-/* Copyright (c) 2010-2020. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2010-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. */
/* Redefine the classical malloc/free/realloc functions so that they fit well in the mmalloc framework */
#define _GNU_SOURCE
-#include <stdlib.h>
+#include "mmprivate.h"
#include <dlfcn.h>
-
-#include "mmprivate.h"
-#include "src/internal_config.h"
-#include "src/mc/mc_base.h"
-#include "src/mc/remote/mc_protocol.h"
-#include "src/xbt_modinter.h"
#include <math.h>
+#include <stdlib.h>
/* ***** Whether to use `mmalloc` of the underlying malloc ***** */
static int __malloc_use_mmalloc;
+int mmalloc_pagesize = 0;
int malloc_use_mmalloc(void)
{
}
/* Override the malloc-like functions if MC is activated at compile time */
-#if SIMGRID_HAVE_MC
-
/* ***** Temporary allocator
*
* This is used before we have found the real malloc implementation with dlsym.
if (mm_initialized)
return;
mm_initializing = 1;
- __malloc_use_mmalloc = getenv(MC_ENV_VARIABLE) ? 1 : 0;
+ __malloc_use_mmalloc = getenv(MC_ENV_SOCKET_FD) ? 1 : 0;
if (__malloc_use_mmalloc) {
__mmalloc_current_heap = mmalloc_preinit();
} else {
mm_real_calloc = dlsym(RTLD_NEXT, "calloc");
#endif
}
+ mmalloc_pagesize = getpagesize();
+
mm_initializing = 0;
mm_initialized = 1;
}
mfree(mdp, p);
UNLOCK(mdp);
}
-#endif /* SIMGRID_HAVE_MC */