mirror of
https://github.com/nodejs/node.git
synced 2025-05-13 14:51:50 +00:00

PR-URL: https://github.com/nodejs/node/pull/45894 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
30 lines
765 B
JavaScript
30 lines
765 B
JavaScript
'use strict';
|
|
// Flags: --expose-gc
|
|
|
|
const common = require('../common');
|
|
|
|
// On IBMi, the rss memory always returns zero
|
|
if (common.isIBMi)
|
|
common.skip('On IBMi, the rss memory always returns zero');
|
|
|
|
const v8 = require('v8');
|
|
const assert = require('assert');
|
|
|
|
const before = process.memoryUsage.rss();
|
|
|
|
for (let i = 0; i < 1000000; i++) {
|
|
v8.serialize('');
|
|
}
|
|
|
|
global.gc();
|
|
|
|
const after = process.memoryUsage.rss();
|
|
|
|
if (process.config.variables.asan) {
|
|
assert(after < before * 10, `asan: before=${before} after=${after}`);
|
|
} else if (process.config.variables.node_builtin_modules_path) {
|
|
assert(after < before * 4, `node_builtin_modules_path: before=${before} after=${after}`);
|
|
} else {
|
|
assert(after < before * 2, `before=${before} after=${after}`);
|
|
}
|