summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2015-11-29 22:17:31 -0500
committerJason Carey <jcarey@argv.me>2015-11-30 10:48:06 -0500
commitb76257f1921451c2c3249d18ae9c43bc35b5a09e (patch)
tree8a2f19e40d8117825a6eb205fd6b3d6bdd3122a5
parentf9450a619c2df8a2cb5925393095d6044a110afc (diff)
downloadmongo-b76257f1921451c2c3249d18ae9c43bc35b5a09e.tar.gz
SERVER-21359 Drop pooled scopes at end of shell _main
Bench run uses pooled scopes in the shell. We need to drop those at the end of _main to make ASAN happy.
-rw-r--r--src/mongo/shell/dbshell.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp
index 004117231ba..22b9e22d91d 100644
--- a/src/mongo/shell/dbshell.cpp
+++ b/src/mongo/shell/dbshell.cpp
@@ -60,6 +60,7 @@
#include "mongo/util/net/ssl_options.h"
#include "mongo/util/password.h"
#include "mongo/util/quick_exit.h"
+#include "mongo/util/scopeguard.h"
#include "mongo/util/signal_handlers.h"
#include "mongo/util/stacktrace.h"
#include "mongo/util/startup_test.h"
@@ -682,6 +683,9 @@ int _main(int argc, char* argv[], char** envp) {
mongo::ScriptEngine::setup();
mongo::globalScriptEngine->setScopeInitCallback(mongo::shell_utils::initScope);
mongo::globalScriptEngine->enableJIT(!shellGlobalParams.nojit);
+
+ auto poolGuard = MakeGuard([] { ScriptEngine::dropScopeCache(); });
+
unique_ptr<mongo::Scope> scope(mongo::globalScriptEngine->newScope());
shellMainScope = scope.get();