diff options
author | Jason Evans <je@fb.com> | 2012-05-15 21:48:14 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2012-05-15 21:48:14 (GMT) |
commit | 781fe75e0a03f13bc1f5403acbbf87796ceea1dc (patch) | |
tree | 7770a9c45a5769f29dbe000b5b8a5ac69d8a3716 /src/jemalloc.c | |
parent | 3860eac17023933180ef5dfb5bd24077cda57dfe (diff) | |
download | jemalloc-781fe75e0a03f13bc1f5403acbbf87796ceea1dc.zip jemalloc-781fe75e0a03f13bc1f5403acbbf87796ceea1dc.tar.gz jemalloc-781fe75e0a03f13bc1f5403acbbf87796ceea1dc.tar.bz2 |
Auto-detect whether running inside Valgrind.
Auto-detect whether running inside Valgrind, thus removing the need to
manually specify MALLOC_CONF=valgrind:true.
Diffstat (limited to 'src/jemalloc.c')
-rw-r--r-- | src/jemalloc.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c index bc54cd7..77ea8c8 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -377,6 +377,20 @@ malloc_conf_init(void) const char *opts, *k, *v; size_t klen, vlen; + /* + * Automatically configure valgrind before processing options. The + * valgrind option remains in jemalloc 3.x for compatibility reasons. + */ + if (config_valgrind) { + opt_valgrind = (RUNNING_ON_VALGRIND != 0) ? true : false; + if (config_fill && opt_valgrind) { + opt_junk = false; + assert(opt_zero == false); + opt_quarantine = JEMALLOC_VALGRIND_QUARANTINE_DEFAULT; + opt_redzone = true; + } + } + for (i = 0; i < 3; i++) { /* Get runtime configuration. */ switch (i) { @@ -553,20 +567,7 @@ malloc_conf_init(void) CONF_HANDLE_BOOL(opt_utrace, "utrace") } if (config_valgrind) { - bool hit; - CONF_HANDLE_BOOL_HIT(opt_valgrind, - "valgrind", hit) - if (config_fill && opt_valgrind && hit) { - opt_junk = false; - opt_zero = false; - if (opt_quarantine == 0) { - opt_quarantine = - JEMALLOC_VALGRIND_QUARANTINE_DEFAULT; - } - opt_redzone = true; - } - if (hit) - continue; + CONF_HANDLE_BOOL(opt_valgrind, "valgrind") } if (config_xmalloc) { CONF_HANDLE_BOOL(opt_xmalloc, "xmalloc") |