diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-11-09 13:20:58 -0500 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-11-12 11:13:38 -0500 |
commit | 0d345a87c62fed483103c684d91901d0c5d424af (patch) | |
tree | 0b0002e3769b9996cbb229bcbb30455cf6a1f066 /src/mongo/util/tcmalloc_server_status_section.cpp | |
parent | 0c25b468fd93fb86c010d3bcaeab81c2e59ae2fe (diff) | |
download | mongo-0d345a87c62fed483103c684d91901d0c5d424af.tar.gz |
SERVER-17105 Check for running under Valgrind
Diffstat (limited to 'src/mongo/util/tcmalloc_server_status_section.cpp')
-rw-r--r-- | src/mongo/util/tcmalloc_server_status_section.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mongo/util/tcmalloc_server_status_section.cpp b/src/mongo/util/tcmalloc_server_status_section.cpp index a6a9066f865..2a696d72882 100644 --- a/src/mongo/util/tcmalloc_server_status_section.cpp +++ b/src/mongo/util/tcmalloc_server_status_section.cpp @@ -27,9 +27,14 @@ #define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault +#ifdef _WIN32 +#define NVALGRIND +#endif + #include "mongo/platform/basic.h" #include <gperftools/malloc_extension.h> +#include <valgrind/valgrind.h> #include "mongo/base/init.h" #include "mongo/db/commands/server_status.h" @@ -63,9 +68,11 @@ void threadStateChange() { // Register threadStateChange callback MONGO_INITIALIZER(TCMallocThreadIdleListener)(InitializerContext*) { - registerThreadIdleCallback(&threadStateChange); - invariant(MallocExtension::instance()->GetNumericProperty( - "tcmalloc.max_total_thread_cache_bytes", &tcmallocPoolSize)); + if (!RUNNING_ON_VALGRIND) { + registerThreadIdleCallback(&threadStateChange); + invariant(MallocExtension::instance()->GetNumericProperty( + "tcmalloc.max_total_thread_cache_bytes", &tcmallocPoolSize)); + } LOG(1) << "tcmallocPoolSize: " << tcmallocPoolSize << "\n"; return Status::OK(); } |