11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci// Flags: --expose-gc 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst common = require('../common'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci// On IBMi, the rss memory always returns zero 71cb0ef41Sopenharmony_ciif (common.isIBMi) 81cb0ef41Sopenharmony_ci common.skip('On IBMi, the rss memory always returns zero'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciconst v8 = require('v8'); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ciconst before = process.memoryUsage.rss(); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_cifor (let i = 0; i < 1000000; i++) { 151cb0ef41Sopenharmony_ci v8.serialize(''); 161cb0ef41Sopenharmony_ci} 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciasync function main() { 191cb0ef41Sopenharmony_ci await common.gcUntil('RSS should go down', () => { 201cb0ef41Sopenharmony_ci const after = process.memoryUsage.rss(); 211cb0ef41Sopenharmony_ci if (process.config.variables.asan) { 221cb0ef41Sopenharmony_ci console.log(`asan: before=${before} after=${after}`); 231cb0ef41Sopenharmony_ci return after < before * 10; 241cb0ef41Sopenharmony_ci } else if (process.config.variables.node_builtin_modules_path) { 251cb0ef41Sopenharmony_ci console.log(`node_builtin_modules_path: before=${before} after=${after}`); 261cb0ef41Sopenharmony_ci return after < before * 10; 271cb0ef41Sopenharmony_ci } 281cb0ef41Sopenharmony_ci console.log(`before=${before} after=${after}`); 291cb0ef41Sopenharmony_ci return after < before * 10; 301cb0ef41Sopenharmony_ci }); 311cb0ef41Sopenharmony_ci} 321cb0ef41Sopenharmony_ci 331cb0ef41Sopenharmony_cimain(); 34