bithavoc / express-winston

express.js middleware for winstonjs
https://www.npmjs.com/package/express-winston
MIT License
796 stars 187 forks source link

Potential memory leak #231

Open dcurletti opened 4 years ago

dcurletti commented 4 years ago

Has anyone seen a heap dump similar to the image below? Not yet certain its related to this package, but it seems like our exception logs are causing a large number of other objects to be held in memory.

image

yinzara commented 4 years ago

I'm a bit confused. Aren't you saying that if the GC ran, it would clear all the objects out of memory? If that's the case wouldn't that imply there isn't a leak and just that you have enough available memory in your system that a GC isn't running automatically and when it would the leak would be gone?

yinzara commented 4 years ago

Could you also post your express-winston (and winston if applicable) configuration?

If you're using a "msg" option that is a function that returns a string with mustache interpolations then the app can grow in memory usage extremely quickly as it has to compile the template with every request.

https://github.com/bithavoc/express-winston/blob/master/index.js#L160