mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 20:29:23 +01:00
464d1c1558
Fixes: https://github.com/nodejs/node/issues/43740 PR-URL: https://github.com/nodejs/node/pull/43741 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
29 lines
822 B
JavaScript
29 lines
822 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const {
|
|
assertDetailedShape,
|
|
expectExperimentalWarning
|
|
} = require('../common/measure-memory');
|
|
const vm = require('vm');
|
|
const assert = require('assert');
|
|
|
|
expectExperimentalWarning();
|
|
{
|
|
const arr = [];
|
|
const count = 10;
|
|
for (let i = 0; i < count; ++i) {
|
|
const context = vm.createContext({
|
|
test: new Array(100).fill('foo')
|
|
});
|
|
arr.push(context);
|
|
}
|
|
// Check that one more context shows up in the result
|
|
vm.measureMemory({ mode: 'detailed', execution: 'eager' })
|
|
.then(common.mustCall((result) => {
|
|
// We must hold on to the contexts here so that they
|
|
// don't get GC'ed until the measurement is complete
|
|
assert.strictEqual(arr.length, count);
|
|
assertDetailedShape(result, count + common.isWindows);
|
|
}));
|
|
}
|