September 21, 2020

Google Chrome tries to solve the problem of 100% CPU caused by the segment heap memory mechanism

2 min read

Microsoft has added a memory management mechanism called segment heap in Windows 10 Version 2004, which helps to reduce memory usage.

Initially, the segment heap memory management mechanism was only applicable to UWP applications such as the classic version of the Microsoft Edge browser. Later, Microsoft gradually expanded it.

Now, this new memory management mechanism has supported traditional desktop programs, and it is said that Microsoft Edge based on Chromium reduces memory by 27%.

The Google Chrome team once enabled this mechanism in the middle of the year, but then Google engineers discovered that the processor usage would increase significantly after enabling the segment heap memory mechanism.

That is to say, although the memory usage is reduced, the processor usage is full. Google engineers have suspended the use of the segment heap memory mechanism.

CVE-2018-6177

In the previous article on suspending the heap memory mechanism, we have mentioned that Microsoft engineers provide two solutions to alleviate the problem of increased processor usage.

Solution 1: Reduce the amount of instantaneous stack allocation of the browser, but this requires major changes to the entire browser project code, so it is a long-term optimization plan.

Solution 2: Improve the performance of the segment heap itself. This solution can only be optimized and solved by the Windows 10 development team, and cannot be directly processed by the software.

In response to these solutions, the Google Chrome development team is not prepared to rewrite the entire project code, so Google engineers decided to adopt the second optimization solution after research.

But this requires the help of the Windows 10 development team. At present, Google engineers have posted on Github and hope that Microsoft will assist in adding two experimental options.

The two experimental options proposed by Google engineers are all about the improvement of the system to create a segment heap, which really requires Microsoft engineers to optimize the system kernel.

Google engineers researched the SDK package and proposed a plan including creating a segment heap instead of an NT heap, and another option is to create an NT heap instead of a segment heap.

In the case of creating an NT heap instead of a segment heap, it is also necessary to prevent the application from requesting to create a segment heap, that is, even if the segment heap is requested, the system will only create an NT heap.

The Google Chrome development team hopes that after Microsoft provides these two options, the Chromium project team can conduct targeted tests to see which works better.

Of course, for the moment, the heap memory mechanism will not appear on Google Chrome in a short period of time, unless Google and Microsoft can solve the problem of soaring processor usage.