Advanced GPU Control needed for browserwindows


#1

Hi all,

I would like to set how much GPU RAM is being used as to prevent the app from overflowing on windows. Does anyone have any expert advice?

I am using electron to build an automatic player for windows. This player plays a mix of video’s (h264 encoded mp4), html and jpeg based on a schedule (sort of like a presentation).
I tested the app on several windows devices, the results vary greatly!

All devices are tiny computers by Asus. In general I noticed 2 distinct differences:

On devices that have no hardware acceleration the chromium gpu process uses up about 30MB of shared RAM, this number never changes, regardless of the content played. The CPU however has all the load here, meaning it is decoding the mp4’s (h264) with software instead of hardware.

On devices with hardware acceleration the cpu load is of course less, but the RAM memory used up by the chromium gpu-process varies greatly. While displaying jpeg or html the RAM is about 0.5GB, when mp4’s kick in the RAM memory easily goes up to 2GB and more.

On the stronger devices without hardware acceleration this is not a big issue, they have 8GB of shared memory or more and don’t crash. However some of the other devices have only 4GB of shared memory and can run out of memory quite easily.

The result of this lack of memory is either the app crashes completely (message with memory overflow is displayed) or the app just hangs (keeps running but doesn’t do anything anymore, usually just displays a white screen).

I know that I can pass certain flags to browserwindow using app.commandLine.appendSwitch.

These are a few of the flags that I tried and the effect they had, I found a list of them here:

  • –force-gpu-mem-available-mb=600 ==> no effect whatsoever, process behaves as before and still surpasses 2GB of RAM.
  • –disable-gpu ==> This one obviously worked but is undesirable because it disabled hardware acceleration completely
  • –disable-gpu-memory-buffer-compositor-resources ==> no change
  • –disable-gpu-memory-buffer-video-frames ==> no change
  • –disable-gpu-rasterization ==> no change
  • –disable-gpu-sandbox ==> no change

Why are some of these command line switches not having any effect on the GPU behaviour? All devices have onboard GPU and shared RAM. I know the Command Line Switches are being used on startup because when I check the processes in the windows task manager I can see the switches have been past to the processes (using the the command line tab in the task manager). So the switches are loaded but still appear to be ignored.

I would like to set how much GPU RAM is being used as to prevent the app from overflowing on windows. Does anyone have any expert advice?