commit de20aed8ca32f33af74df745e6be7c246cea3839
parent 5309f14497354586fb1d097289fc3c6762599dc8
Author: Jeff Muizelaar <jmuizelaar@mozilla.com>
Date: Thu, 18 Dec 2025 23:46:33 +0000
Bug 2006953 - Make memory reporter timeout a pref. r=mccr8
I've occasionally run into this timeout for processes that have a lot of
memory. It'd be nice to be able to up the timeout in those situations.
Differential Revision: https://phabricator.services.mozilla.com/D277037
Diffstat:
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
@@ -13182,6 +13182,13 @@
value: 500
mirror: always
+# This timeout (ms) needs to be long enough to allow for the
+# possibility of DMD reports and/or running on a low-end phone.
+- name: memory.reporter.timeout
+ type: uint32_t
+ value: 180000
+ mirror: never
+
#---------------------------------------------------------------------------
# Prefs starting with "middlemouse."
#---------------------------------------------------------------------------
diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp
@@ -31,6 +31,7 @@
#include "VRProcessManager.h"
#include "mozilla/MemoryReportingProcess.h"
#include "mozilla/Preferences.h"
+#include "mozilla/StaticPrefs_memory.h"
#include "mozilla/RDDProcessManager.h"
#include "mozilla/Services.h"
#include "mozilla/glean/XpcomMetrics.h"
@@ -1996,8 +1997,8 @@ nsresult nsMemoryReporterManager::StartGettingReports() {
if (!s->mChildrenPending.IsEmpty()) {
nsCOMPtr<nsITimer> timer;
rv = NS_NewTimerWithFuncCallback(
- getter_AddRefs(timer), TimeoutCallback, this, kTimeoutLengthMS,
- nsITimer::TYPE_ONE_SHOT,
+ getter_AddRefs(timer), TimeoutCallback, this,
+ StaticPrefs::memory_reporter_timeout(), nsITimer::TYPE_ONE_SHOT,
"nsMemoryReporterManager::StartGettingReports"_ns);
if (NS_WARN_IF(NS_FAILED(rv))) {
FinishReporting();
diff --git a/xpcom/base/nsMemoryReporterManager.h b/xpcom/base/nsMemoryReporterManager.h
@@ -231,9 +231,6 @@ class nsMemoryReporterManager final : public nsIMemoryReporterManager,
nsISupports* aHandleReportData, bool aAnonymize);
static void TimeoutCallback(nsITimer* aTimer, void* aData);
- // Note: this timeout needs to be long enough to allow for the
- // possibility of DMD reports and/or running on a low-end phone.
- static const uint32_t kTimeoutLengthMS = 180000;
mozilla::Mutex mMutex;
bool mIsRegistrationBlocked MOZ_GUARDED_BY(mMutex);