MCPcopy Index your code
hub / github.com/nodegit/nodegit / garbageCollect

Function garbageCollect

test/utils/garbage_collect.js:3–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1// aggressively collects garbage until we fail to improve terminatingIterations
2// times.
3function garbageCollect() {
4 var terminatingIterations = 3;
5 var usedBeforeGC = Number.MAX_VALUE;
6 var nondecreasingIterations = 0;
7 for ( ; ; ) {
8 global.gc();
9 var usedAfterGC = process.memoryUsage().heapUsed;
10 if (usedAfterGC >= usedBeforeGC) {
11 nondecreasingIterations++;
12 if (nondecreasingIterations >= terminatingIterations) {
13 break;
14 }
15 }
16 usedBeforeGC = usedAfterGC;
17 }
18}
19
20module.exports = garbageCollect;

Callers 6

leakTestFunction · 0.85
commit.jsFile · 0.85
rebase.jsFile · 0.85
signature.jsFile · 0.85
filter.jsFile · 0.85
remote.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…