diff options
author | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 16:02:31 +0000 |
---|---|---|
committer | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 16:02:31 +0000 |
commit | c72f16a764f26fc27c2d8fcc2099076ea1d63b59 (patch) | |
tree | 49797157de966a36d29f99fd8dadd833cadb8062 | |
parent | b640603331a241ea5a93362c0897055294a89e10 (diff) | |
download | chromium_src-c72f16a764f26fc27c2d8fcc2099076ea1d63b59.zip chromium_src-c72f16a764f26fc27c2d8fcc2099076ea1d63b59.tar.gz chromium_src-c72f16a764f26fc27c2d8fcc2099076ea1d63b59.tar.bz2 |
Call two more shutdown functions, and set an environment variable,
to make nss play well with valgrind, as recommended by Wan-Teh in
http://groups.google.com/group/mozilla.dev.tech.crypto/msg/49fe8582df376d06
Set the same environment variables in chrome_test.sh/valgrind_test.py
and valgrind.sh, and explain which is which.
Review URL: http://codereview.chromium.org/42326
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12093 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/nss_init.cc | 9 | ||||
-rwxr-xr-x | tools/valgrind/valgrind.sh | 6 | ||||
-rwxr-xr-x | tools/valgrind/valgrind_test.py | 3 |
3 files changed, 18 insertions, 0 deletions
diff --git a/base/nss_init.cc b/base/nss_init.cc index e3ce1ae..c0114b7 100644 --- a/base/nss_init.cc +++ b/base/nss_init.cc @@ -5,6 +5,8 @@ #include "base/nss_init.h" #include <nss.h> +#include <plarena.h> +#include <prinit.h> // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=455424 // until NSS 3.12.2 comes out and we update to it. @@ -76,7 +78,14 @@ class NSSInitSingleton { if (status != SECSuccess) LOG(ERROR) << "NSS_Shutdown failed, leak? See " "http://code.google.com/p/chromium/issues/detail?id=4609"; + + PL_ArenaFinish(); + + PRStatus prstatus = PR_Cleanup(); + if (prstatus != PR_SUCCESS) + LOG(ERROR) << "PR_Cleanup failed?"; } + private: SECMODModule *root_; }; diff --git a/tools/valgrind/valgrind.sh b/tools/valgrind/valgrind.sh index 2aa06fc..08bc480 100755 --- a/tools/valgrind/valgrind.sh +++ b/tools/valgrind/valgrind.sh @@ -7,6 +7,10 @@ # it the suppression file, and some helpful arguments (automatically attaching # the debugger on failures, etc). Run it from your repo root, something like: # $ sh ./tools/valgrind/valgrind.sh ./chrome/Hammer/chrome +# +# This is mostly intended for running the chrome browser interactively. +# To run unit tests, you probably want to run chrome_tests.sh instead. +# That's the script used by the valgrind buildbot. set -e @@ -32,12 +36,14 @@ SUPPRESSIONS="$(cd `dirname "$0"` && pwd)/suppressions.txt" set -v # Pass GTK glib allocations through to system malloc so valgrind sees them. +# Prevent NSS from recycling memory arenas so valgrind can track origins. # Ask GTK to abort on any critical or warning assertions. # Overwrite newly allocated or freed objects with 0x41 to catch inproper use. # smc-check=all is required for valgrind to see v8's dynamic code generation. # trace-children to follow into the renderer processes. # Prompt to attach gdb when there was an error detected. G_SLICE=always-malloc \ +NSS_DISABLE_ARENA_FREE_LIST=1 \ G_DEBUG=fatal_warnings \ "$VALGRIND" \ --trace-children=yes \ diff --git a/tools/valgrind/valgrind_test.py b/tools/valgrind/valgrind_test.py index 6fc7da5..4306d29 100755 --- a/tools/valgrind/valgrind_test.py +++ b/tools/valgrind/valgrind_test.py @@ -84,6 +84,9 @@ class Valgrind(object): logging.info("starting execution...") proc = self.ValgrindCommand() + os.putenv("G_SLICE", "always-malloc") + os.putenv("NSS_DISABLE_ARENA_FREE_LIST", "1") + common.RunSubprocess(proc, self._timeout) # Always return true, even if running the subprocess failed. We depend on |