mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
With Meteor 1.6 / Node 8, I noticed _buildLocalPackages taking multiple seconds on initial server startup and restart, and the problem seems to be that we call the global.gc function too often. This wasn't a problem in previous versions of Node, as far as I know, but it makes sense to heed the comment in tools/utils/gc.js, now that it matters.
11 lines
432 B
JavaScript
11 lines
432 B
JavaScript
import { throttle } from "underscore";
|
|
|
|
export const requestGarbageCollection =
|
|
// For this global function to be defined, the --expose-gc flag must
|
|
// have been passed to node at the bottom of the ../../meteor script,
|
|
// probably via the TOOL_NODE_FLAGS environment variable.
|
|
typeof global.gc === "function"
|
|
// Restrict actual garbage collections to once per 500ms.
|
|
? throttle(global.gc, 500)
|
|
: function () {};
|