From abfa282e96b45ea80dba1cdb36247a6caddcb225 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 14 Sep 2017 15:09:50 +1000 Subject: [PATCH] Bug 1399727 - Fix double-reporting of memory in ScriptPreloader. r=kmag. DMD indicates double-reporting for mURL, indicating that it is shared. --HG-- extra : rebase_source : b6e82cc3e4dbba9a59750b6be8117597034f23d7 --- js/xpconnect/loader/ScriptPreloader.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/xpconnect/loader/ScriptPreloader.h b/js/xpconnect/loader/ScriptPreloader.h index 4c83b0736847..7f6fd16da55b 100644 --- a/js/xpconnect/loader/ScriptPreloader.h +++ b/js/xpconnect/loader/ScriptPreloader.h @@ -269,8 +269,12 @@ private: return size; } - size += (mURL.SizeOfExcludingThisEvenIfShared(mallocSizeOf) + + // Note: mURL and mCachePath use the same string for scripts loaded + // by the message manager. The following statement avoids + // double-measuring in that case. + size += (mURL.SizeOfExcludingThisIfUnshared(mallocSizeOf) + mCachePath.SizeOfExcludingThisEvenIfShared(mallocSizeOf)); + return size; }