Bug 1464621 - Ensure we finish any ongoing incremental GC before collecting stats for memory reporting r=sfink?
authorJon Coppeard <jcoppeard@mozilla.com>
Mon, 13 May 2019 17:13:17 +0000
changeset 535525 e153188e2d93b251c16a6a1d74fd1e2d952fe2eb
parent 535524 46ad1099db88415ea5af702bfd4986a5957b9d6f
child 535526 7b168d837392915c41fe70b506222115659ff078
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1464621
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1464621 - Ensure we finish any ongoing incremental GC before collecting stats for memory reporting r=sfink? Differential Revision: https://phabricator.services.mozilla.com/D30880
js/src/vm/MemoryMetrics.cpp
--- a/js/src/vm/MemoryMetrics.cpp
+++ b/js/src/vm/MemoryMetrics.cpp
@@ -694,16 +694,21 @@ static bool FindNotableScriptSources(JS:
   js_delete(runtime.allScriptSources);
   runtime.allScriptSources = nullptr;
   return true;
 }
 
 static bool CollectRuntimeStatsHelper(JSContext* cx, RuntimeStats* rtStats,
                                       ObjectPrivateVisitor* opv, bool anonymize,
                                       IterateCellCallback statsCellCallback) {
+  // Finish any ongoing incremental GC that may change the data we're gathering
+  // and ensure that we don't do anything that could start another one.
+  gc::FinishGC(cx);
+  JS::AutoAssertNoGC nogc(cx);
+
   JSRuntime* rt = cx->runtime();
   if (!rtStats->realmStatsVector.reserve(rt->numRealms)) {
     return false;
   }
 
   size_t totalZones = rt->gc.zones().length() + 1;  // + 1 for the atoms zone.
   if (!rtStats->zoneStatsVector.reserve(totalZones)) {
     return false;