mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
c5eb2c4190
When --node-builtin-modules-path is used, we read and create new strings for builtins in each realm which increases the memory usage. As a result GC may not be able to keep up with the allocation done in the loop in the test. As a workaround, give GC a bit more time by waiting for a timer in the loop. PR-URL: https://github.com/nodejs/node/pull/50735 Refs: https://github.com/nodejs/node/issues/50726 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
19 lines
537 B
JavaScript
19 lines
537 B
JavaScript
// Flags: --experimental-shadow-realm --max-old-space-size=20
|
|
'use strict';
|
|
|
|
/**
|
|
* Verifying modules imported by ShadowRealm instances can be correctly
|
|
* garbage collected.
|
|
*/
|
|
|
|
const common = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
const { runAndBreathe } = require('../common/gc');
|
|
|
|
const mod = fixtures.fileURL('es-module-shadow-realm', 'state-counter.mjs');
|
|
|
|
runAndBreathe(async () => {
|
|
const realm = new ShadowRealm();
|
|
await realm.importValue(mod, 'getCounter');
|
|
}, 100).then(common.mustCall());
|