mirror of
https://github.com/gperftools/gperftools
synced 2025-01-19 21:40:58 +00:00
issue-536: do not PrintStats if running under valgrind
When we detect running under valgrind we do not initialize our own malloc. So trying to print malloc stats when asked via MALLOCSTATS cannot work. This does fix proposed by Philippe Waroquiers. In which we detect running under valgrind prior to checking MALLOCSTATS environment variable and refuse printing stats if we detect valgrind.
This commit is contained in:
parent
6979583592
commit
cb65e49b83
@ -926,7 +926,11 @@ TCMallocGuard::TCMallocGuard() {
|
||||
|
||||
TCMallocGuard::~TCMallocGuard() {
|
||||
if (--tcmallocguard_refcount == 0) {
|
||||
const char* env = getenv("MALLOCSTATS");
|
||||
const char* env = NULL;
|
||||
if (!RunningOnValgrind()) {
|
||||
// Valgrind uses it's own malloc so we cannot do MALLOCSTATS
|
||||
env = getenv("MALLOCSTATS");
|
||||
}
|
||||
if (env != NULL) {
|
||||
int level = atoi(env);
|
||||
if (level < 1) level = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user