node/test/fixtures/workload/grow.js
Joyee Cheung 6d06ac2202
src: add --heapsnapshot-near-heap-limit option
This patch adds a --heapsnapshot-near-heap-limit CLI option
that takes heap snapshots when the V8 heap is approaching
the heap size limit. It will try to write the snapshots
to disk before the program crashes due to OOM.

PR-URL: https://github.com/nodejs/node/pull/33010
Refs: https://github.com/nodejs/node/issues/27552
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2021-08-31 10:55:04 -04:00

12 lines
255 B
JavaScript

'use strict';
const chunk = parseInt(process.env.TEST_CHUNK) || 1000;
let arr = [];
function runAllocation() {
const str = JSON.stringify(process.config).slice(0, chunk);
arr.push(str);
setImmediate(runAllocation);
}
setImmediate(runAllocation);