Repository navigation
fix(devserver): memory-conscious GC profile for the Hot Reload host (backport #24209) - #24415
Merged
agneszitte merged 1 commit intoSep 11, 2026
Merged
Conversation
The dev-server host is a long-running background daemon on the developer's machine, but inherited the Microsoft.NET.Sdk.Web default (Server GC), which is throughput-oriented and retains committed memory. Under Hot Reload each emit allocates tens of MB of transient garbage; Server GC feels no pressure to collect it, so RSS climbs into multi-GB over a session. Align the host GC profile with a memory-conscious background daemon: - ServerGarbageCollection=false + ConcurrentGarbageCollection=true (Workstation background GC: pressure applied early, transient garbage collected). - runtimeconfig.template.json: System.GC.ConserveMemory=5 (compact heap + decommit to OS), HeapHardLimitPercent=66 (relative last-resort ceiling), HighMemoryPercent=70 (react earlier under machine memory pressure). Fixes #24203 (cherry picked from commit 26bcadf)
dr1rrb
approved these changes
Sep 4, 2026
dr1rrb
left a comment
Member
There was a problem hiding this comment.
Backport approved — straight mergify backport of an already-approved master fix.
1 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Issue: closes #24203
PR Type:
🐞 Bugfix
What changed? 🚀
The Hot Reload dev-server host (
Uno.UI.RemoteControl.Host) is a long-running background daemon on the developer's machine, but it inherited theMicrosoft.NET.Sdk.Webdefault GC profile (Server GC), which is throughput-oriented and holds onto committed memory. Under Hot Reload each emit allocates a large amount of transient garbage (tens of MB on a real app, for a ~150 KB delta); with Server GC the runtime feels no pressure to collect it, so the host's working set climbs monotonically into the multi-GB range over a working session (see #24203 / #24151).This aligns the host's GC profile with a memory-conscious background daemon:
ServerGarbageCollection=false+ConcurrentGarbageCollection=true→ Workstation background GC: pressure is applied early, so the transient garbage is actually collected and the working set stays bounded.runtimeconfig.template.json:System.GC.ConserveMemory=5→ keeps the heap compact and decommits freed memory back to the OS (so RSS actually goes down, not just the managed heap).System.GC.HeapHardLimitPercent=66→ relative last-resort ceiling (no absolute, machine-dependent value to pick).System.GC.HighMemoryPercent=70→ the GC becomes aggressive earlier when the machine is under memory pressure — a good citizen on a shared dev box.Measured (synthetic LOH churn, 40 iterations, ~27 MB live heap in all three cases) — peak / final process working set:
The emitted
runtimeconfig.jsonwas verified to contain the five expectedSystem.GC.*values.This is the fast, low-risk mitigation track. The root-cause tracks (non-incremental generators, connection/workspace lifetime, per-solution/baseline/target workspace sharing) are tracked separately in #24204, #24205, #24206 and #24207.
PR Checklist ✅
runtimeconfig.json.Screenshots Compare Test Runresults — N/A (no UI change).This is an automatic backport of pull request #24209 done by [Mergify](https://mergify.com).