MCPcopy Index your code
hub / github.com/nodejs/node / createObject

Function createObject

test/common/gc.js:101–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99 });
100
101 async function createObject() {
102 const obj = await fn();
103 f.register(obj);
104 if (count++ < maxCount && !anyFinalized) {
105 setImmediate(createObject, 1);
106 }
107 // This can force a more thorough GC, but can slow the test down
108 // significantly in a big heap. Use it with care.
109 if (count % generateSnapshotAt === 0) {
110 // XXX(joyeecheung): This itself can consume a bit of JS heap memory,
111 // but the other alternative writeHeapSnapshot can run into disk space
112 // not enough problems in the CI & be slower depending on file system.
113 // Just do this for now as long as it works and only invent some
114 // internal voodoo when we absolutely have no other choice.
115 require('v8').getHeapSnapshot().pause().read();
116 console.log(`Generated heap snapshot at ${count}`);
117 }
118 if (count % logEvery === 0) {
119 console.log(`Created ${count} objects`);
120 }
121 if (anyFinalized) {
122 console.log(`Found finalized object at ${count}, stop testing`);
123 }
124 }
125
126 createObject();
127}

Callers 1

checkIfCollectableFunction · 0.70

Calls 8

getHeapSnapshotMethod · 0.80
pauseMethod · 0.65
fnFunction · 0.50
setImmediateFunction · 0.50
requireFunction · 0.50
registerMethod · 0.45
readMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…