Open Bug 1646819 Opened 4 years ago Updated 3 years ago

Investigate whether the Windows 10 2004 SegmentHeap feature is useful to Firefox

Categories

(Core :: Memory Allocator, enhancement)

enhancement

Tracking

()

REOPENED

People

(Reporter: RyanVM, Unassigned)

References

()

Details

I came across an article today discussing the new SegmentHeap feature shipping in Windows 10 2004 claiming it reduced Edge memory usage by up to 27%.

I'm not sure if our architecture is amenable to utilizing this new feature or not, but I figured it was at least filing a bug on to investigate!
https://docs.microsoft.com/windows/win32/sbscs/application-manifests#heaptype

The article (which Ryan put a link to in the URL section) has some links to Chromium bugs.

The documentation I was looking at was talking about allocations under 16kb, so it sounds like maybe this is some kind of system allocator which we don't use because we have jemalloc? I'm not sure how Chrome does things.

This seems to be for HeapAlloc, which we don't use.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID

Doing a little digging, while Firefox may not explicitly call the HeapAlloc function, the heap documentation implies its a default allocation that happens for each process

https://docs.microsoft.com/en-us/windows/win32/memory/heap-functions

https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests#heaptype

The documentation mentions that the changes impact win32 APIs so I dont know if that impacts Firefox x64

(In reply to Mike Hommey [:glandium] from comment #2)

This seems to be for HeapAlloc, which we don't use.

Windows does not provide a way to override the memory allocator process-wide. Sure, our binaries use jemalloc, but any memory allocated by Win32 libraries themselves (or any other dependent DLL, including injected ones) goes through HeapAlloc.

In essence, our Windows processes contain two distinct heap implementations.

Status: RESOLVED → REOPENED
Resolution: INVALID → ---

I think to compare this, we will need to run multiple triggers of Talos; but we'll need to make sure our Talos machines support it - "This element is supported in Windows 10, version 2004 (build 19041) and later."

Talos machines are probably not running that.

Flags: needinfo?(jmaher)

IIUC, we need to build with the Win10 19041 SDK also.

we don't have that, our machines run 1803, there are no plans in the short term to upgrade this- but we have plans by the end of the year.

Flags: needinfo?(jmaher)

AWSY would be the best way to see memory impact, but I'm not sure if we track whatever metric would be affected by this. (Most or all of the metrics we track related to jemalloc's allocations.)

That said, it would probably affect some number in the memory report, so it wouldn't be impossible to modify it a bit to see if there's a change in whatever metric is relevant.

They will not be using Segment Heap due to the perf regressions.
https://bugs.chromium.org/p/chromium/issues/detail?id=1102281#c29

Instead, they are using something called as "Partition Alloc " : https://chromium-review.googlesource.com/c/chromium/src/+/2543884

You need to log in before you can comment on or make changes to this bug.