Repository navigation
Windows Theme Switcher v2.1.0
v2.1.0 — idle footprint in the kilobyte range
A tray app is idle almost all the time, but the resident set kept every page it touched at startup (13.6 MB) and, once the panel had been opened, the WebView2 runtime pages (~45 MB). Windows never hands them back by itself.
The app now calls EmptyWorkingSet at the right moments, which moves those pages to the standby list. Private commit is untouched, so nothing is lost — the pages come back on the next touch.
Measured on the release binary
| State | Working set (Task Manager) | Private commit |
|---|---|---|
| Tray only, panel never opened | 148 KB (was 13,632 KB) | 2.3 MB |
| Tray, after one panel open/close | 148 KB median, max spike 1.9 MB (was ~45 MB) | 6.9 MB |
| Panel open | ~49 MB + WebView2 helpers | — |
- idle CPU: 0.00 s over 30 s (the janitor reuses the existing wake-event thread, so no extra thread is created)
- theme apply still 1 ms; panel opens in ~1.0 s
- zero
msedgewebview2.exeprocesses whenever the panel is closed
How
- trims after startup, after the panel is destroyed, after it is hidden, and after every tray action
- a 3 s janitor pass keeps the observed value low even though the WebView2 runtime touches a few MB every ~15 s
- two-pass trim (
trim_settle) because a single call lands around 1 MB instead of the ~200 KB floor strip = truein the release profile
Note on the two numbers: working set is what Task Manager shows and what trimming minimises; commit is the memory actually allocated to the process and does not need to be resident. Both are documented in docs/ARCHITECTURE.md §8.6.