summaryrefslogtreecommitdiff
path: root/src/mongo/util/tcmalloc_server_status_section.cpp
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-11-09 13:20:58 -0500
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-11-12 11:13:38 -0500
commit0d345a87c62fed483103c684d91901d0c5d424af (patch)
tree0b0002e3769b9996cbb229bcbb30455cf6a1f066 /src/mongo/util/tcmalloc_server_status_section.cpp
parent0c25b468fd93fb86c010d3bcaeab81c2e59ae2fe (diff)
downloadmongo-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.cpp13
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();
}