diff options
author | earthdok@chromium.org <earthdok@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-15 05:03:47 +0000 |
---|---|---|
committer | earthdok@chromium.org <earthdok@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-15 05:03:47 +0000 |
commit | 69c019477ad0f4c68e8ba354a53b8932f9e0277a (patch) | |
tree | eddd318a615309c05864802db3d66c252d22b631 /chrome/browser/browser_process_impl.cc | |
parent | 8bd0f8b502620ace43b4c14097b7faa2109b808a (diff) | |
download | chromium_src-69c019477ad0f4c68e8ba354a53b8932f9e0277a.zip chromium_src-69c019477ad0f4c68e8ba354a53b8932f9e0277a.tar.gz chromium_src-69c019477ad0f4c68e8ba354a53b8932f9e0277a.tar.bz2 |
Invoke LeakSanitizer in BrowserProcessImpl::ReleaseModule().
Leak detection is normally invoked from an AtExit handler which runs very late
in the shutdown process. This doesn't play well with Chrome, because memory is
often intentionally leaked during shutdown, causing a flood of uninteresting
leak reports. Instead we try to invoke leak detection at the earliest possible
point in the shutdown process.
BUG=307043
R=glider@chromium.org, thestig@chromium.org
Review URL: https://codereview.chromium.org/26895007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_process_impl.cc')
-rw-r--r-- | chrome/browser/browser_process_impl.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index a48c7e2..6825a2e 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -12,6 +12,7 @@ #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/debug/alias.h" +#include "base/debug/leak_annotations.h" #include "base/path_service.h" #include "base/prefs/json_pref_store.h" #include "base/prefs/pref_registry_simple.h" @@ -341,6 +342,14 @@ unsigned int BrowserProcessImpl::ReleaseModule() { print_job_manager_->Shutdown(); #endif +#if defined(LEAK_SANITIZER) + // Check for memory leaks now, before we start shutting down threads. Doing + // this early means we won't report any shutdown-only leaks (as they have + // not yet happened at this point). + // If leaks are found, this will make the process exit immediately. + __lsan_do_leak_check(); +#endif + CHECK(base::MessageLoop::current()->is_running()); #if defined(OS_MACOSX) |