11cb0ef41Sopenharmony_ci// Flags: --max-old-space-size=16 --trace-gc 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ci// This tests that vm.compileFunction with dynamic import callback does not leak. 51cb0ef41Sopenharmony_ci// See https://github.com/nodejs/node/issues/44211 61cb0ef41Sopenharmony_cirequire('../common'); 71cb0ef41Sopenharmony_ciconst { checkIfCollectable } = require('../common/gc'); 81cb0ef41Sopenharmony_ciconst vm = require('vm'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciasync function createCompiledFunction() { 111cb0ef41Sopenharmony_ci return vm.compileFunction(`"${Math.random().toString().repeat(512)}"`, [], { 121cb0ef41Sopenharmony_ci async importModuleDynamically() {}, 131cb0ef41Sopenharmony_ci }); 141cb0ef41Sopenharmony_ci} 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_cicheckIfCollectable(createCompiledFunction, 2048); 17