After Microsoft started rolling out Windows 10 May 2020 Update, the tech giant claimed that it had found a way to fix Chromium-based browsers RAM usage. The fix is ‘Segment Heap’, which is now included in Windows 10 and it should help reduce memory usage with some Win32 desktop apps, such as Google Chrome and Edge.
Segment Heap is a technical under the hood improvement whereby the “modern heap implementation” reduces your apps overall memory usage.
In other words, Segment Heap is something that developers need to use in their apps and Microsoft is already using this for its Chromium Edge.
Microsoft’s internal testing has recorded a 27% reduction in memory usage of Edge browser, and you can also expect some improvement in Chrome if Google is able to implement this feature.
According to a Chromium commit that we spotted earlier this year, Google was also going to adopt it for Chrome. However, Google later clarified that its RAM-saving fix Microsoft came up won’t be enabled in future versions of Chrome, including version 85.
Google said that Segment Heap did cut down on RAM usage by their browser, but it also ended up causing performance regression, including high CPU usage.
So far, Google has been using .exe manifest method for enabling the segment heap, which does save some memory, but it wastes CPU time.
“The savings most comes from the browser and network processes, while the cost mostly comes from the renderer process,” Google said.
Google’s new testing data suggests that it would be quite easy to use segment heap without performance regression if Microsoft agrees to add a function to Windows that would set or clear the “segment-heap-enabled” bit in RtlpHpHeapFeatures in ntdll.dll.
Code inspection makes it clear that it would also be easy to add flags to HeapCreate and RtlCreateHeap to force-enable or force-disable the segment heap. These methods would work nicely in conjunction with the manifest, which by itself is too inflexible to be a complete solution.
Google’s senior developer has also submitted a formal post on Github seeking Microsoft’s assistance for implementing these two flags:
- HEAP_ENABLE_SEGMENT_HEAP – create a segment heap instead of an NT heap.
- HEAP_DISABLE_SEGMENT_HEAP – create an NT heap instead of a segment heap, even if the segment heap was requested in the application manifest.
“These flags would be useful for all Chromium-based browsers,” Google developer noted.
But does this mean we won’t be getting Google Chrome’s RAM saving update anytime soon? Hopefully not.
Google is still experimenting with Segment Heap and Microsoft could also help Google while it runs more tests. Google will reconsider support for this feature in the future when there’s a way to implement it successfully or Microsoft jumps in with their own fix.