From 47496e9dba73d6a82567d7bb02464ffbbd23ed8f Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Mon, 15 May 2017 16:00:20 -0400 Subject: [PATCH] Call requestGarbageCollection in Isopack#_writeTool. This method appears to be causing large spikes in memory consumption on Circle CI during the `meteor --get-ready` preparation step, which often leads to the test process being killed. Also added a call in IsopackCache#_loadLocalPackage for good measure. We're now calling requestGarbageCollection pretty frequently when we run Node with --expose-gc, but that currently only happens during Circle CI tests, so I don't think we need to implement the improvements suggested in tools/utils/gc.js, yet. Previously: 35f488e140c5df4a2bc70de271feb38921d2a6d3, f6df21ff1ed7e54db2d1df90f6d766f971a93f58 --- tools/isobuild/isopack-cache.js | 2 ++ tools/isobuild/isopack.js | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/tools/isobuild/isopack-cache.js b/tools/isobuild/isopack-cache.js index 5da0a09ed9..4f2a5f3ed7 100644 --- a/tools/isobuild/isopack-cache.js +++ b/tools/isobuild/isopack-cache.js @@ -383,6 +383,8 @@ export class IsopackCache { }); } } + + requestGarbageCollection(); } } diff --git a/tools/isobuild/isopack.js b/tools/isobuild/isopack.js index 034aaced80..e78746124e 100644 --- a/tools/isobuild/isopack.js +++ b/tools/isobuild/isopack.js @@ -14,6 +14,7 @@ var utils = require('../utils/utils.js'); var buildPluginModule = require('./build-plugin.js'); var Console = require('../console/console.js').Console; var Profile = require('../tool-env/profile.js').Profile; +import { requestGarbageCollection } from "../utils/gc.js"; var rejectBadPath = function (p) { if (p.match(/\.\./)) { @@ -1802,6 +1803,8 @@ _.extend(Isopack.prototype, { symlink: false }); + requestGarbageCollection(); + // Build all of the isopackets now, so that no build step is required when // you're actually running meteor from a release in order to load packages. var isopacketBuildContext = isopackets.makeIsopacketBuildContext(); @@ -1812,6 +1815,8 @@ _.extend(Isopack.prototype, { // process are going to be the current tool's isopackets, not the // isopackets that we're writing out. _.each(isopackets.ISOPACKETS, function (packages, isopacketName) { + requestGarbageCollection(); + buildmessage.enterJob({ title: "compiling " + isopacketName + " packages for the tool" }, function () { @@ -1830,6 +1835,8 @@ _.extend(Isopack.prototype, { return; } + requestGarbageCollection(); + image.write( builder.enter(files.pathJoin('isopackets', isopacketName))); });