mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
0b6b2a4dc7
PR-URL: https://github.com/nodejs/node/pull/54355 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
35 lines
903 B
JavaScript
35 lines
903 B
JavaScript
'use strict';
|
|
// Flags: --expose-gc
|
|
|
|
const common = require('../common');
|
|
const { gcUntil } = require('../common/gc');
|
|
|
|
// 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 before = process.memoryUsage.rss();
|
|
|
|
for (let i = 0; i < 1000000; i++) {
|
|
v8.serialize('');
|
|
}
|
|
|
|
async function main() {
|
|
await gcUntil('RSS should go down', () => {
|
|
const after = process.memoryUsage.rss();
|
|
if (common.isASan) {
|
|
console.log(`ASan: before=${before} after=${after}`);
|
|
return after < before * 10;
|
|
} else if (process.config.variables.node_builtin_modules_path) {
|
|
console.log(`node_builtin_modules_path: before=${before} after=${after}`);
|
|
return after < before * 10;
|
|
}
|
|
console.log(`before=${before} after=${after}`);
|
|
return after < before * 10;
|
|
});
|
|
}
|
|
|
|
main();
|