From 03a69dcb6cbedb76522854b8bf6bde624d5c8301 Mon Sep 17 00:00:00 2001 From: "eroman@chromium.org" Date: Tue, 22 Sep 2009 00:04:59 +0000 Subject: Enable LeakTracker on release builds. This is intended to be temporary, so we can get data from the dev channel on why URLRequest objects are leaking at shutdown. WARNING: it may cause a slight slowdown on page cycler. Also as part of this change, I switched the order that we check URLFetcher / URLRequest. This is simply so that if both URLFetcher and URLRequest have leaked, we will report the URLFetcher leak rather than the URLRequest leak. BUG=http://crbug.com/21199, http://crbug.com/18372 Review URL: http://codereview.chromium.org/217005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26765 0039d316-1c4b-4281-b951-d872f2087c98 --- base/leak_tracker.h | 12 ++++++++++-- chrome/browser/browser_process_impl.cc | 11 ++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/base/leak_tracker.h b/base/leak_tracker.h index de6ff29..9084f9a 100644 --- a/base/leak_tracker.h +++ b/base/leak_tracker.h @@ -5,8 +5,16 @@ #ifndef BASE_LEAK_TRACKER_H_ #define BASE_LEAK_TRACKER_H_ -// Only enable leak tracking in debug builds. -#ifndef NDEBUG +// Temporarily enable LeakTracker in all builds (both +// release and debug). This will have an impact on performance, but +// is intended to help track down a leak which reproduces on dev +// channel. +// +// TODO(eroman): Restore the old code which only enabled LeakTracker +// for debug builds. +// +// http://crbug.com/21199, http://crbug.com/18372 +#ifndef ENABLE_LEAK_TRACKER #define ENABLE_LEAK_TRACKER #endif diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 68a3dc3..f971e80 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -106,8 +106,17 @@ class IOThread : public BrowserProcessSubThread { protected: virtual void CleanUp() { // URLFetcher and URLRequest instances must NOT outlive the IO thread. - base::LeakTracker::CheckForLeaks(); + // + // Strictly speaking, URLFetcher's CheckForLeaks() should be done on the + // UI thread. However, since there _shouldn't_ be any instances left + // at this point, it shouldn't be a race. + // + // We check URLFetcher first, since if it has leaked then an associated + // URLRequest will also have leaked. However it is more useful to + // crash showing the callstack of URLFetcher's allocation than its + // URLRequest member. base::LeakTracker::CheckForLeaks(); + base::LeakTracker::CheckForLeaks(); BrowserProcessSubThread::CleanUp(); } -- cgit v1.1