I'm inspecting a heap snapshot created by [email protected], running on Node.js 10.16.0 in Amazon Linux with kernel 4.14.123-86.109.amzn1.x86_64. Heap snapshot is 1GB and, good news, strings visibly consume most of it, using 750MB of both shallow and retained size.
Most of these strings are bound to be logged by winston ([email protected], [email protected], [email protected]), at a log level (silly) lower than my app's minimal level (debug). So, a few dozen times per second,
winston.log with a logLevel silly.silly < debug).Expected: strings are GCed and life goes on.
Actual: strings accumulate in memory, are not GCed, node OOMs at max-heap-size (1.4GB).
I am positive strings do leak. What I'm describing is not nominal operation between two normal GCs because, looking at the contents of the strings in the snapshot, I see a great deal of variation that, in the case of my app, can only come from hours of running.
Also, the devtools sometimes report huge sizes for these strings (23MB for a string that is actually 1KB), and the retainers tree is humongous, with >18000 levels of a next method inside objects message and chunk (see screenshot below).
So, my two questions are:
next / message / chunk objects belong to?Available to provide additional information. Thank you!

This was a bug in Winston related to how it used streams. It was fixed in a pull request, you can read more about the issue and the fix here: https://github.com/winstonjs/winston/issues/1871
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With