Electron GPU process memory leak


I am currently working on an Electron productivity app which lets user add multiple services such as Gmail and Slack with notifications for these as well. Hence, I am creating and handling multiple webviews in the app. The UI is built using React and Material UI components for React.

The ‘GPU’ process of Electron is quite unpredictable and takes up Ram anywhere between 100 - 500 MB. I now see an issue where after waking up the system after idle for 5-10 minutes or waking it up from sleep causes the GPU process to suffer a memory leak, taking up 7+ GB of RAM sometimes.

This happens in a very random fashion on Windows and Mac as well. For now, I have put in a fix to periodically check the memory usage of the GPU process, and if >1 GB, kill it so that Electron spawns a new one. This causes a screen flicker on the app.

I have tried the chromium flag to limit its maximum memory usage, but does not have any effect.

app.commandLine.appendSwitch(’–force-gpu-mem-available-mb’, ‘500’);

If someone could point me in the right direction to debug this, it would be very helpful!

Electron: v 1.7.6

Node: v 7.9.0