summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-09-15 22:14:56 +0200
committerLennart Poettering <lennart@poettering.net>2009-09-15 22:14:56 +0200
commit31bbf1ba735cbeff5640424d5d0c06a94614764d (patch)
tree0829b201b69c7c9fadd9b8519fe0c4393bf81033
parent89c9711bfe4429b9fa67f80448f59644e15f8ba4 (diff)
detect alternative memory allocators and quit early
-rw-r--r--mutrace.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mutrace.c b/mutrace.c
index 069fd72..d5ddae2 100644
--- a/mutrace.c
+++ b/mutrace.c
@@ -35,6 +35,7 @@
#include <sys/syscall.h>
#include <unistd.h>
#include <sys/prctl.h>
+#include <malloc.h>
/* FIXMES:
*
@@ -221,6 +222,15 @@ static void setup(void) {
if (initialized)
return;
+ if (__malloc_hook) {
+ fprintf(stderr,
+ "mutrace: Detected non-glibc memory allocator. Your program uses some\n"
+ "mutrace: alternative memory allocator (jemalloc?) which is not compatible with\n"
+ "mutrace: mutrace. Please rebuild your program with the standard memory\n"
+ "mutrace: allocator or fix mutrace to handle yours correctly.\n");
+ real_exit(1);
+ }
+
t = hash_size;
if (parse_env("MUTRACE_HASH_SIZE", &t) < 0 || t <= 0)
fprintf(stderr, "mutrace: WARNING: Failed to parse $MUTRACE_HASH_SIZE.\n");