0

I have some memory problems with my electron app. On startup the memory usage is about 120 MB. The JS heap stays constant at 32 MB. Without performing any actions in the browser window, the memory usage of the renderer in the task manager goes up by about 1 MB every second. After increasing by 20 MB it seems to go down by around 16 again (propably GC). but leaving the window open for several minutes results in 300 MB memory usage. So there is a memory leak somewhere.

Since the JS heap size never changes, I assume the leak in inside the Node process, am I correct on that part? How can I analyze the memory usage in the electron/node process? (since the chrome profile does not seem to help in that case)

related to https://spectrum.chat/electron/general/debugging-high-memory-usage-in-electron~80057ff2-a51c-427f-b6e1-c297d47baf5b and https://www.electronjs.org/docs/tutorial/performance

user3740359
  • 395
  • 1
  • 6
  • 16

1 Answers1

1

I have the same problem, my app starts with 200MB of used memory and less than 20 minutes, it uses more than 450MB just doing nothing...only showing some images. It happened the same with a raspberry pi +3b. The use of memory grows 'till rasp dies.

What i found is that if you have the devtools window opened (i assume you have for debug purposes) it just eat all memory. Once i closed the devtools window, my app on a Win system uses 100MB (stable) and in my raspberry pi 300MB (stable).

I've read somewhere that when use GPU to render it uses a lot of memory too so i used

app.disableHardwareAcceleration();

Nelson
  • 33
  • 1
  • 6