Repository navigation
fix(devserver): memory-conscious GC profile for the Hot Reload host - #24209
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
|
devid-bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the GC configuration for Uno.UI.RemoteControl.Host (the Hot Reload dev-server host) to reduce working-set growth in long-running developer sessions by switching away from the Web SDK’s default Server GC profile and adding GC tuning via runtimeconfig.template.json.
Changes:
- Switch the host to Workstation GC by setting
ServerGarbageCollection=false(and explicitly enabling concurrent/background GC). - Add
runtimeconfig.template.jsonwith memory-conserving GC knobs (ConserveMemory,HeapHardLimitPercent,HighMemoryPercent). - Ensure
runtimeconfig.template.jsonis not treated as web content to copy to output or include in packaging.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Uno.UI.RemoteControl.Host/Uno.UI.RemoteControl.Host.csproj |
Overrides Web SDK default Server GC and excludes runtimeconfig.template.json from Content output/packaging. |
src/Uno.UI.RemoteControl.Host/runtimeconfig.template.json |
Adds runtime GC config properties to keep the daemon’s memory usage bounded and more responsive to system pressure. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
Claude finished @dr1rrb's task in 2m 5s —— View job Code Review
Verdict: LGTM — no blocking issues. The change is technically correct, well-scoped, and well-documented. Detailed notes:
Commit and PR form
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24209/wasm-skia-net9/index.html |
|
@Mergifyio backport release/stable/6.7 |
✅ Backports have been createdDetails
|
…6.7/pr-24209 fix(devserver): memory-conscious GC profile for the Hot Reload host (backport #24209)
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).