I'm inspecting a heap snapshot created by node-heapdump @0.3.14, 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 (winston@3.2.1, winston-transport@4.3.0, winston-logsene@2.0.7), 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
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.