Skip to content

DevServer Hot Reload host: reconsider System.GC.Server (+ optional GCHeapHardLimitPercent) #24203

Closed

Description

@dr1rrb

Follow-up from the investigation on #24151.

The Hot Reload host (Uno.UI.RemoteControl.Host) ships with "System.GC.Server": true in its runtimeconfig. For a long-lived background broker this hides collectable garbage until the OS commit limit is reached.

Measured (heavy Uno app, real EnC path): each hot-reload emit allocates ~70 MB of transient garbage for a ~150 KB metadata delta. With Server GC, gen2 stayed effectively frozen (0–1 collections) while the managed heap climbed monotonically by hundreds of MB. A forced gen2 GC reclaims the bulk instantly (the original reporter's gcdump reclaimed ~1 GB in one collection). So most of the growth is collectable garbage the GC feels no pressure to collect, and DOTNET_gcServer=0 cannot override runtimeconfig — users currently have no opt-out.

Proposal

  • Switch the host to Workstation GC (or at least make it configurable). Workstation GC applies pressure far sooner for this allocation pattern and bounds RSS.
  • Optionally set a heap limit. An absolute GCHeapHardLimit is hard to choose (client-machine dependent, low value = risk); prefer GCHeapHardLimitPercent with a generous bound so the GC compacts under pressure instead of letting the OS terminate unrelated apps.

Fast mitigation, not a root-cause fix — see companion issues on generators and workspace/connection lifetime.

Activity

  1. added a commit that references this issue on Aug 28, 2026
    26bcadf
  2. added theissue type on Sep 11, 2026
  3. khaskoul commented on Sep 14, 2026

    @khaskoul

    Verified fixed on Uno.WinUI.DevServer 6.8.0-dev.159 (Uno.Sdk 6.8.0-dev.39).

    Uno.UI.RemoteControl.Host.runtimeconfig.json (identical for the net9.0 and net10.0 hosts):

    "System.GC.ConserveMemory": 5,
    "System.GC.HeapHardLimitPercent": 66,
    "System.GC.HighMemoryPercent": 70,
    "System.GC.Concurrent": true,
    "System.GC.Server": false

    Both asks are in — Workstation GC, plus the percentage-based heap limit the ticket preferred over an absolute one.
    Walking the cached packages, this landed between 6.8.0-dev.87 (Server: true) and 6.8.0-dev.149.

    Behaviour: 12 hot-reload emits against a running desktop app (12 × Found 1 metadata updates in the host log),
    dotnet-counters on the host — committed heap 265 → 273 MB, working set 567 → 596 MB and plateauing, gen0 8 / gen1 3 /
    gen2 0, 68 MB allocated total. No monotonic climb. gen2 staying at 0 is benign here since the heap isn't growing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions