Closed visvk closed 5 years ago
I've run this script and I haven't observed that huge amount of memory usage:
const os = require('os');
const moment = require('moment')
require('moment-duration-format')
const showMemoryUsage = (when) => {
const used = process.memoryUsage();
console.log(`aprox memory usage ${when}:`);
Object.keys(used).forEach(key => {
const memory = Math.round(used[key] / 1024 / 1024 * 100 ) / 100;
console.log(`${key}: ${memory} MB`)
});
console.log('\n');
}
for(var i = 1; i < 10000; i++) {
moment.duration(i, 'seconds').format('d [days] h [hours] m [mins]')
}
showMemoryUsage('at the end');
Output:
aprox memory usage at the end:
rss: 45.93 MB
heapTotal: 17.23 MB
heapUsed: 6.34 MB
external: 0.01 MB
This bug is related to node v9.9
With node v10 (v10.11.0) there is no memory leak.
I've re-run your code in node v9.9 :
aprox memory usage at the end:
rss: 332.03 MB
heapTotal: 49.33 MB
heapUsed: 21.21 MB
external: 0.01 MB
Thanks for your reply @visvk
Then may this issue be closed.
Hi, with simple code
the process grown up to ~350MB. Is this an expected behavior?
moment 2.22.2 moment-duration-format 2.2.2 node v9.9.0