Bug 933882 - Force GC in Debugger mochitests for ASan. (r=past, a=lsblakk)
authorShu-yu Guo <shu@rfrn.org>
Wed, 20 Nov 2013 22:50:28 -0800
changeset 166677 423ca965db1818dd9ba0c57ec6351e8ce9a02cd2
parent 166676 01a9cffd0aa1c3a5d3af2482d4502c4705ddf28b
child 166678 0d47cfb2bb101ef85632b36e3a657b12d1b8a2de
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast, lsblakk
bugs933882
milestone27.0a2
Bug 933882 - Force GC in Debugger mochitests for ASan. (r=past, a=lsblakk)
browser/devtools/debugger/test/head.js
browser/devtools/netmonitor/test/browser_net_large-response.js
browser/devtools/profiler/test/head.js
browser/devtools/shadereditor/test/head.js
--- a/browser/devtools/debugger/test/head.js
+++ b/browser/devtools/debugger/test/head.js
@@ -30,16 +30,20 @@ const EXAMPLE_URL = "http://example.com/
 waitForExplicitFinish();
 
 registerCleanupFunction(function() {
   info("finish() was called, cleaning up...");
   Services.prefs.setBoolPref("devtools.debugger.log", gEnableLogging);
 
   // Properly shut down the server to avoid memory leaks.
   DebuggerServer.destroy();
+
+  // Debugger tests use a lot of memory, so force a GC to help fragmentation.
+  info("Forcing GC after debugger test.");
+  Cu.forceGC();
 });
 
 // Import the GCLI test helper
 let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
 Services.scriptloader.loadSubScript(testDir + "../../../commandline/test/helpers.js", this);
 
 // Redeclare dbg_assert with a fatal behavior.
 function dbg_assert(cond, e) {
--- a/browser/devtools/netmonitor/test/browser_net_large-response.js
+++ b/browser/devtools/netmonitor/test/browser_net_large-response.js
@@ -39,9 +39,13 @@ function test() {
       EventUtils.sendMouseEvent({ type: "mousedown" },
         document.getElementById("details-pane-toggle"));
       EventUtils.sendMouseEvent({ type: "mousedown" },
         document.querySelectorAll("#details-pane tab")[3]);
     });
 
     aDebuggee.performRequests(1, CONTENT_TYPE_SJS + "?fmt=html-long");
   });
+
+  // This test uses a lot of memory, so force a GC to help fragmentation.
+  info("Forcing GC after netmonitor test.");
+  Cu.forceGC();
 }
--- a/browser/devtools/profiler/test/head.js
+++ b/browser/devtools/profiler/test/head.js
@@ -24,16 +24,21 @@ let testDir = gTestPath.substr(0, gTestP
 Services.scriptloader.loadSubScript(testDir + "../../../commandline/test/helpers.js", this);
 
 registerCleanupFunction(function () {
   helpers = null;
   Services.prefs.clearUserPref(PROFILER_ENABLED);
   Services.prefs.clearUserPref(REMOTE_ENABLED);
   Services.prefs.clearUserPref(SHOW_PLATFORM_DATA);
   DebuggerServer.destroy();
+
+  // These tests use a lot of memory due to GL contexts, so force a GC to help
+  // fragmentation.
+  info("Forcing GC after profiler test.");
+  Cu.forceGC();
 });
 
 function getProfileInternals(uid) {
   let profile = (uid != null) ? gPanel.profiles.get(uid) : gPanel.activeProfile;
   let win = profile.iframe.contentWindow;
   let doc = win.document;
 
   return [win, doc];
--- a/browser/devtools/shadereditor/test/head.js
+++ b/browser/devtools/shadereditor/test/head.js
@@ -34,16 +34,21 @@ const BLENDED_GEOMETRY_CANVAS_URL = EXAM
 waitForExplicitFinish();
 
 let gToolEnabled = Services.prefs.getBoolPref("devtools.shadereditor.enabled");
 
 registerCleanupFunction(() => {
   info("finish() was called, cleaning up...");
   Services.prefs.setBoolPref("devtools.debugger.log", gEnableLogging);
   Services.prefs.setBoolPref("devtools.shadereditor.enabled", gToolEnabled);
+
+  // These tests use a lot of memory due to GL contexts, so force a GC to help
+  // fragmentation.
+  info("Forcing GC after shadereditor test.");
+  Cu.forceGC();
 });
 
 function addTab(aUrl, aWindow) {
   info("Adding tab: " + aUrl);
 
   let deferred = promise.defer();
   let targetWindow = aWindow || window;
   let targetBrowser = targetWindow.gBrowser;