diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/util/tcmalloc_server_status_section.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/util/tcmalloc_server_status_section.cpp b/src/mongo/util/tcmalloc_server_status_section.cpp index c215956c0b3..e7623b068a1 100644 --- a/src/mongo/util/tcmalloc_server_status_section.cpp +++ b/src/mongo/util/tcmalloc_server_status_section.cpp @@ -38,6 +38,7 @@ #include "mongo/base/init.h" #include "mongo/db/commands/server_status.h" +#include "mongo/db/server_parameters.h" #include "mongo/db/service_context.h" #include "mongo/transport/transport_layer.h" #include "mongo/util/log.h" @@ -55,11 +56,17 @@ const int kManyClients = 40; stdx::mutex tcmallocCleanupLock; +MONGO_EXPORT_SERVER_PARAMETER(tcmallocEnableMarkThreadIdle, bool, true); + /** * Callback to allow TCMalloc to release freed memory to the central list at * favorable times. Ideally would do some milder cleanup or scavenge... */ void threadStateChange() { + if (!tcmallocEnableMarkThreadIdle.load()) { + return; + } + if (getGlobalServiceContext()->getTransportLayer()->sessionStats().numOpenSessions <= kManyClients) return; |