| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1c47da1 commit 1d8e65a
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,21 +1,24 @@ | |||
| 1 | - // Flags: --experimental-vm-modules --max-old-space-size=16 --trace-gc | ||
| 1 | + // Flags: --expose-internals --experimental-vm-modules --max-old-space-size=16 --trace-gc | ||
| 2 | 2 | 'use strict'; | |
| 3 | 3 | ||
| 4 | 4 | // This tests that vm.SourceTextModule() does not leak. | |
| 5 | 5 | // See: https://github.com/nodejs/node/issues/33439 | |
| 6 | - require('../common'); | ||
| 7 | - const { checkIfCollectable } = require('../common/gc'); | ||
| 6 | + const common = require('../common'); | ||
| 7 | + const { checkIfCollectableByCounting } = require('../common/gc'); | ||
| 8 | 8 | const vm = require('vm'); | |
| 9 | 9 | ||
| 10 | - async function createSourceTextModule() { | ||
| 11 | - // Try to reach the maximum old space size. | ||
| 12 | - const m = new vm.SourceTextModule(` | ||
| 13 | - const bar = new Array(512).fill("----"); | ||
| 14 | - export { bar }; | ||
| 15 | - `); | ||
| 16 | - await m.link(() => {}); | ||
| 17 | - await m.evaluate(); | ||
| 18 | - return m; | ||
| 19 | - } | ||
| 10 | + const outer = 32; | ||
| 11 | + const inner = 128; | ||
| 20 | 12 | ||
| 21 | - checkIfCollectable(createSourceTextModule, 4096, 1024); | ||
| 13 | + checkIfCollectableByCounting(async (i) => { | ||
| 14 | + for (let j = 0; j < inner; j++) { | ||
| 15 | + // Try to reach the maximum old space size. | ||
| 16 | + const m = new vm.SourceTextModule(` | ||
| 17 | + const bar = new Array(512).fill("----"); | ||
| 18 | + export { bar }; | ||
| 19 | + `); | ||
| 20 | + await m.link(() => {}); | ||
| 21 | + await m.evaluate(); | ||
| 22 | + } | ||
| 23 | + return inner; | ||
| 24 | + }, vm.SourceTextModule, outer).then(common.mustCall()); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments