What is the method that reduced 'crash due to insufficient memory' of Firefox for Windows by 70%?

Many people have experienced that 'the screen suddenly closed' while using a web browser. Gabriela Svelt, a member of the development team of the web browser 'Firefox', provides an overview of memory optimizations made to reduce crashes in Firefox for Windows.

Improving Firefox stability with this one weird trick - Mozilla Hacks - the Web developer blog


Firefox is also available for OSs other than Windows such as macOS and Linux, but according to Mr. Svelt, crashes due to insufficient memory occur most often in Firefox for Windows. The frequent occurrence of crashes in Windows is affected by the memory management method of Windows.

Various operating systems, including Windows, create a swap file to continue system operation when memory is insufficient. At this time, Windows operates to 'commit virtual memory' and a swap file is created on 'committed memory'. Therefore, in situations where 'committed memory' is insufficient, the swap file will not be created and memory allocation will fail.

As a result of the Firefox development team verifying the memory usage at the time of crash, it was confirmed that Firefox crashes if the 'committed memory' is insufficient even if there is enough free space in the physical memory on Windows. I was. However, it was difficult to directly deal with this phenomenon. Therefore, the development team built into Firefox the behavior of ``waiting for a short time instead of crashing when memory allocation fails'', and set it to wait until Windows commits virtual memory after memory allocation fails. Did.

As a result of the above change being officially released in '

Firefox 105 ', the occurrence rate of crashes due to insufficient memory has decreased by more than 70%. We also applied similar changes to Firefox for Android and Firefox OS, resulting in lower crash rates on both platforms.

The Firefox development team is working on developing appropriate memory management in different situations of ``insufficient committed memory'' and ``insufficient physical memory''.

in Software, Posted by log1o_hf