• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Flags: --max-old-space-size=16 --trace-gc
2'use strict';
3
4// This tests that vm.Script with dynamic import callback does not leak.
5// See: https://github.com/nodejs/node/issues/33439
6require('../common');
7const { checkIfCollectable } = require('../common/gc');
8const vm = require('vm');
9
10async function createContextifyScript() {
11  // Try to reach the maximum old space size.
12  return new vm.Script(`"${Math.random().toString().repeat(512)}";`, {
13    async importModuleDynamically() {},
14  });
15}
16checkIfCollectable(createContextifyScript, 2048, 512);
17