blob: 513cfbc367245175eb5caa5337e47728661ea3cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Flags: --expose-gc
'use strict';
const common = require('../common');
const {
assertSummaryShape,
expectExperimentalWarning
} = require('../common/measure-memory');
const vm = require('vm');
expectExperimentalWarning();
// Test lazy memory measurement - we will need to global.gc()
// or otherwise these may not resolve.
{
vm.measureMemory()
.then(common.mustCall(assertSummaryShape));
global.gc();
}
{
vm.measureMemory({})
.then(common.mustCall(assertSummaryShape));
global.gc();
}
{
vm.measureMemory({ mode: 'summary' })
.then(common.mustCall(assertSummaryShape));
global.gc();
}
{
vm.measureMemory({ mode: 'detailed' })
.then(common.mustCall(assertSummaryShape));
global.gc();
}
|