Hi,
I am struggling to understand why NodeJs do not decrease the resident
memory after a lot of console.log.
If someone could explain me this behaviour I would be very happy.
for (var i = 0; i< 100 * 1000; i++){
console.log(i);
}
setTimeout(function(){ console.log('END') }, 10000000);
The last setTimeout is used to keep nodejs running, so gc happens when node
is idle.
The ouput is the following:
$ while true; do sleep 1; cat /proc/`pgrep node`/status |grep RSS; done
&
$ node --trace_gc log.js
...
99998
99999
VmRSS: 88808 kB
VmRSS: 88808 kB
VmRSS: 88808 kB
VmRSS: 88808 kB
VmRSS: 88808 kB
Mark-sweep 39.5 -> 2.4 MB, 3 / 37 ms.
VmRSS: 57120 kB
Mark-compact 2.4 -> 1.9 MB, 24 ms.
Mark-compact 1.9 -> 1.9 MB, 8 ms.
VmRSS: 30344 kB
VmRSS: 30344 kB
VmRSS: 30344 kB
If I only do 1000 iterations (instead of 100 000), the final VmRSS (after
gc) is less important:
...
998
999
VmRSS: 12084 kB
VmRSS: 12084 kB
VmRSS: 12084 kB
VmRSS: 12084 kB
VmRSS: 12084 kB
Scavenge 2.4 -> 2.2 MB, 0 ms.
Mark-sweep 2.2 -> 1.9 MB, 4 ms.
Mark-compact 1.9 -> 1.9 MB, 15 ms.
VmRSS: 9468 kB
VmRSS: 9468 kB
This thread is cross posted in stack overflow :
http://stackoverflow.com/questions/8856892/node-js-file-memory-leak
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en