简体   繁体   中英

node.js memory usage issue

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?

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM