Wednesday, 4 December 2019

Memory leak in Express API

I am running an API service in Express (~20 endpoints). The app is managed on the server through pm2. Every now and then, I check pm2 console ($ pm2 monit) and observe that the app instance is consuming more and more memory. For instance, on day 1 when the app was first launched, its memory usage was 0mb, then 20mb on day 5, then 100mb on day 20. Since node is garbage collected, once the request-response cycle is complete, the memory should come back to 0mb (?).There's no impact on performance and the application logs do not show anything as well. I am concerned that my app is leaking memory somewhere in the code. Is there any way to identify the leak and resolve this situation?

Submitted December 04, 2019 at 08:19PM by vanillacap

No comments:

Post a Comment