3 ms·
One of the services we develop has been in a state where we can now look at performance and memory optimizations. I've been investigating memory pressure issues
by theogravity 8y ago
One of the services we develop has been in a state where we can now look at performance and memory optimizations. I've been investigating memory pressure issues using the node inspect tools (which interfaces with the Chrome memory profiler).
I noticed that the default stream for console.log in node.js does not get garbage collected, and raised an issue about it in the github node org, where a node dev has acknowledged the behavior.
He provided a link to a larger thread where this is being discussed, but it seems it's been in discussion since 2016.
One possible solution around this is to write log entries to a file instead of using the default stream.
- theogravity 8y agoUpdate: Via bnoordhuis (Ben Noordhuis - node.js dev): I see you posted this over at https://www.reddit.com/r/node/comments/8s2y7b/til_consolelog_entries_will_not_get_garbage/ https://www.reddit.com/r/node/comments/8s2y7b/til_consolelog... but your summary there is wrong. You should update it because it's going to mislead others. The state of things: A connected inspector client will cause console.log() to buffer a bounded number of messages (currently 1,000.) Libuv can buffer messages when you print faster than the sink (tty, pipe, file, etc.) can consume them. That's something you can fix by pacing your writes.