9951 explained code solutions for 126 technologies


nodejsHow to calculate memory script uses


let arr = [];
for ( let i = 0; i < 100000; i++ ) arr.push(i);
console.log(process.memoryUsage().heapUsed);ctrl + c
process.memoryUsage()

returns memory usage stats

heapUsed

returns amount of memory in bytes current process has used