Electron 8.2.3 BrowserWindow in GC roots, but memory not released - memory-leaks

I am developing an electron app. When I close a BrowserWindow it takes a heap snapshot of browser process. The BrowserWindow is in the link of GC roots but the memory is not released.
(source: bcebos.com)

Related

How to detect leak in non-heap memory in Node JS?

Our NodeJS application is facing memory leak issues for a while. Unlike other heap memory leak issues, I found there is a leak in non-heap using NewRelic APM tool. I'm using node 14.15.5 version.
I had gone through various articles to detect memory leaks in heap section but couldn't find one for non-heap. Due to this, GC metrics are poor which in turn increases avg. latency of the application. How do I find the non-heap memory leak? Does NodeJS upgrade helps?

Debugger causes memory to leak in node.js

I am debugging a large node.js app that crashes very infrequently with an out of memory error.
Monitoring the process with OS tools does not show any worrisome trend in rss over long periods of time, but as soon as I attach either Chrome Inspector for Node.js or the VSCode JS debugger, I see memory going up steeply and fairly constantly. Many of the leaked objects seem to be under system, but the rss size increase seems to not be covered by the size of the objects in the heap. I see rss > 1GB, yet the heap only accounts for tens of MB, not 600+ MB increase in rss.
When I detach the debugger the rss goes back to almost the preattach state.
Also, a strange behavior of this app is that under single threaded perpetual load (sending continuously a new request as soon as one was serviced) speed is rather inconsistent. Identical requests are handled fast for a few seconds, then comes a minute of lower CPU usage and extreme slowness and the cycle repeats itself.
When I try to profile the app with Chrome Inspector, node.js crashes promptly.
I stubbed out much of the application. Now the app no longer crashes when profiled, but the debugger induced leak persists.
The retention tree looks like this:
[13]in(GC roots)#3
107 / DevTools console in (Global handles) #29
map in Object #381033
back_pointer in system / Map #382907
back_pointer in system / Map #387465
back_pointer in system / Map #387463
back_pointer in system / Map#387461
...
many long chains like this.
Looking at the Object in this chain, it looks like an HTTP socket
I am new to node.js anyone has any hints as to where to look for problems?

Is there a way to debug memory leaks which happen outside v8 heap

I have a production application running on NodeJS which serves a decent amount of traffic. While things are smooth post deployment, the performance starts to degrade after few hours.
We noticed on newrelic that the non-heap memory of NodeJS continues to increase steadily while V8 heap is kind of consistent. We have tried using Chrome DevTools but couldn't find the issue. Are there any tools which will help me debug the memory leak happening outside V8 heap?
Image: https://i.imgur.com/SP9pAQt.png
Tried Google Chrome DevTools to find the leak but no luck.

node.js memory usage issue

I have created https server using https module. When I hit the server with the requests and run the 'top' command, I can see the memory usage goes on increasing with the subsequent requests. After the server becomes idle the memory usage does't go down, it remains constant as maximum used. If I hit another bunch of transactions again it goes on increasing and stays at same size.
Is this a normal behaviour of Node.js or there is a memory leak issue in my code?
The garbage collector is not called all the time because he block your process. So V8 launch GC when he think it's necessary. So your memory is increasing because the GC has not been fired yet.
You can read this article to learn about the GC management of V8 : https://strongloop.com/strongblog/node-js-performance-garbage-collection/

Memory leak in Node.js outside of heap?

I've just fixed a memory leak in my node application which was in the heap of node.
I've profiled that with Google's Profiler and managed to fix the memory leak.
Now my app is running again for some time, and I've seen that the heap size is pretty constant. No memory leak anymore. But when I check my server's free RAM, I see a decrease...
When I restart my node server the RAM is up to it's normal free RAM.
Now I've heard about that Node.js can save objects and stuff outside of the heap. I think that is what's causing the memory leak here.
How can I see what's taking up the memory? Can't really profile anything, or can I?
I'm using:
node.js: v0.8.18 and
socket.io: v0.9.13
Some other node modules that I'm using are: nodetime, heapdump (will delete this, though), jquery, crypto, request and querystring.
Some graphs:
Free OS memory and
Node RSS and Heap used

Resources