mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
017998971b
Similar to the test-vm-source-text-module-leak fix, use a snapshot to force a thorough GC in order to prevent false positives. PR-URL: https://github.com/nodejs/node/pull/49710 Refs: https://github.com/nodejs/reliability/issues/669 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
17 lines
552 B
JavaScript
17 lines
552 B
JavaScript
// Flags: --max-old-space-size=16 --trace-gc
|
|
'use strict';
|
|
|
|
// This tests that vm.Script with dynamic import callback does not leak.
|
|
// See: https://github.com/nodejs/node/issues/33439
|
|
require('../common');
|
|
const { checkIfCollectable } = require('../common/gc');
|
|
const vm = require('vm');
|
|
|
|
async function createContextifyScript() {
|
|
// Try to reach the maximum old space size.
|
|
return new vm.Script(`"${Math.random().toString().repeat(512)}";`, {
|
|
async importModuleDynamically() {},
|
|
});
|
|
}
|
|
checkIfCollectable(createContextifyScript, 2048, 512);
|