memory leaks - Why does an empty node.js script consume more and more RAM? -


running this:

setinterval(function() {     console.log(process.memoryusage()); }, 1000); 

shows memory usage growing:

{ rss: 9076736, heaptotal: 6131200, heapused: 2052352 } ... time later { rss: 10960896, heaptotal: 6131200, heapused: 2939096 } ... time later { rss: 11177984, heaptotal: 6131200, heapused: 3141576 } 

why happen?

the program isn't empty, it's running timer, checking memory usage, , writing console once second. causes objects created in heap , until garbage collection runs heap usage keep increasing.

if let go should see heapused go down each time garbage collection triggered.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

React Native allow user to reorder elements in a scrollview list -

multithreading - Exception in Application constructor -