I have created https server using https module. When I hit the server with the requests and run the 'top' command, I can see the memory usage goes on increasing with the subsequent requests. After the server becomes idle the memory usage does't go down, it remains constant as maximum used. If I hit another bunch of transactions again it goes on increasing and stays at same size. Is this a normal behaviour of Node.js or there is a memory leak issue in my code?
1 Answer
The garbage collector is not called all the time because he block your process. So V8 launch GC when he think it's necessary. So your memory is increasing because the GC has not been fired yet. You can read this article to learn about the GC management of V8 : https://strongloop.com/strongblog/node-js-performance-garbage-collection/
1 Comment
Viddesh
I am aware of the GC management of V8. Also the node.js apps uses the memory and it goes on increasing with subsequent requests. As per my understanding app reuses the memory which is not released. So is there any way to know that the app is reusing the memory and whats the limit after which it will stop consuming more memory? Or its just my code leaking out memory? I have also tried very simple http server hello world example, same goes with this.