Bug 1070973 - Assert that at some point, the memory measured after a GC is lower than the one before a GC; r=fitzgen
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 13 Sep 2015 13:53:05 -0400
changeset 295027 cd96a343381a64b663d16684a9c0a1aefdceca18
parent 295026 e49720fee5a534ee671d9ea68773a2437b7f7ce1
child 295028 d7b18f4aa01089dab89973f19ebb2e2bfc6a56a9
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfitzgen
bugs1070973
milestone43.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 1070973 - Assert that at some point, the memory measured after a GC is lower than the one before a GC; r=fitzgen
toolkit/devtools/server/tests/mochitest/test_memory_gc_01.html
--- a/toolkit/devtools/server/tests/mochitest/test_memory_gc_01.html
+++ b/toolkit/devtools/server/tests/mochitest/test_memory_gc_01.html
@@ -14,30 +14,33 @@ Bug 1067491 - Test forcing a gc.
 <script src="memory-helpers.js" type="application/javascript;version=1.8"></script>
 <script>
 window.onload = function() {
   SimpleTest.waitForExplicitFinish();
 
   Task.spawn(function* () {
     var { memory, client } = yield startServerAndGetSelectedTabMemory();
 
-    var objects = [];
-    for (var i = 0; i < 1000; i++) {
-      var o = {};
-      o[Math.random] = 1;
-      objects.push(o);
-    }
+    do {
+      var objects = [];
+      for (var i = 0; i < 1000; i++) {
+        var o = {};
+        o[Math.random()] = 1;
+        objects.push(o);
+      }
 
-    objects = null;
-    var { total: beforeGC } = yield memory.measure();
+      objects = null;
+
+      var { total: beforeGC } = yield memory.measure();
 
-    yield memory.forceGarbageCollection();
-    var { total: afterGC } = yield memory.measure();
+      yield memory.forceGarbageCollection();
+      var { total: afterGC } = yield memory.measure();
+    } while(beforeGC < afterGC);
 
-    ok(beforeGC > afterGC);
+    ok(true, "The amount of memory after GC should eventually decrease");
 
     destroyServerAndFinish(client);
   });
 };
 </script>
 </pre>
 </body>
 </html>