From 0c5277a7346657b7c8d72e4f03c96316d70d4411 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 18 Dec 2012 15:14:31 -0800 Subject: [PATCH] Bug 822700 - When DMD is disabled its SizeOf() function shouldn't try to measure non-existent structures. r=jlebar. --HG-- extra : rebase_source : 21066e5173dbc7e4a6c7615f1b355989bf046082 --- memory/replace/dmd/DMD.cpp | 5 +++++ memory/replace/dmd/DMD.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/memory/replace/dmd/DMD.cpp b/memory/replace/dmd/DMD.cpp index 3008ef3b13f..e22ab79bc61 100644 --- a/memory/replace/dmd/DMD.cpp +++ b/memory/replace/dmd/DMD.cpp @@ -1973,6 +1973,11 @@ PrintSortedBlockAndFrameGroups(const Writer& aWriter, MOZ_EXPORT void SizeOf(Sizes* aSizes) { + if (!gIsDMDRunning) { + aSizes->Clear(); + return; + } + aSizes->mStackTraces = 0; for (StackTraceTable::Range r = gStackTraceTable->all(); !r.empty(); diff --git a/memory/replace/dmd/DMD.h b/memory/replace/dmd/DMD.h index b481734c9a4..7af0e9c4859 100644 --- a/memory/replace/dmd/DMD.h +++ b/memory/replace/dmd/DMD.h @@ -57,7 +57,8 @@ struct Sizes size_t mLiveBlockTable; size_t mDoubleReportTable; - Sizes() { memset(this, 0, sizeof(Sizes)); } + Sizes() { Clear(); } + void Clear() { memset(this, 0, sizeof(Sizes)); } }; // Gets the size of various data structures. Used to implement a memory