summaryrefslogtreecommitdiffstats
path: root/base/debug
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 20:37:47 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 20:37:47 +0000
commit50b6c01fb0ed1e95f6e0922d6c44ea01f482ae17 (patch)
tree2fb5686a3b54ce86f9a671b605904afe45faa1ea /base/debug
parentc78f18881208f776cd4f065356924e9036b57b07 (diff)
downloadchromium_src-50b6c01fb0ed1e95f6e0922d6c44ea01f482ae17.zip
chromium_src-50b6c01fb0ed1e95f6e0922d6c44ea01f482ae17.tar.gz
chromium_src-50b6c01fb0ed1e95f6e0922d6c44ea01f482ae17.tar.bz2
memory: don't reserve trace events unless we're using tracing
Even when TraceEvent is disabled, we still poke at it unconditionally via the tracing macros. The ctor would reserve 1024 TraceEvents, allocating ~100kb, and TraceEvents have a ctor that touch the newly-reserved memory, which means it's not just virtual address space, we actually were wasting 100kb per process. Fix it by only reserving space for the TraceEvents once tracing is enabled. (It would be nice if we could avoid paying for any of this stuff in the common case of not using tracing, but this fix is simple.) Review URL: http://codereview.chromium.org/7037034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85810 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/debug')
-rw-r--r--base/debug/trace_event.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/base/debug/trace_event.cc b/base/debug/trace_event.cc
index 5a526f6..4a6cf1c 100644
--- a/base/debug/trace_event.cc
+++ b/base/debug/trace_event.cc
@@ -241,7 +241,6 @@ TraceLog* TraceLog::GetInstance() {
TraceLog::TraceLog()
: enabled_(false) {
- logged_events_.reserve(1024);
}
TraceLog::~TraceLog() {
@@ -285,6 +284,7 @@ void TraceLog::SetEnabled(bool enabled) {
AutoLock lock(lock_);
if (enabled == enabled_)
return;
+ logged_events_.reserve(1024);
enabled_ = enabled;
for (int i = 0; i < g_category_index; i++) {
//TODO(scheib): If changed to enable specific categories instead of all