.agents/skills/wox-memory-debug/SKILL.md
Use this skill to debug hidden-state memory for the two main Wox processes: Go core (wox) and Flutter UI (wox-ui). Keep the first pass boring: measure the same number every time, prove the window is hidden, then attribute memory to Go heap, Flutter heap, or native/cache state.
WoxLauncherController.hideApp() in wox.ui.flutter/wox/lib/controllers/wox_launcher_controller.dart./on/hide and updated PostOnHide() in wox.core/ui/manager.go.powershell -ExecutionPolicy Bypass -File C:\dev\Wox\.agents\skills\wox-memory-debug\scripts\sample-wox-memory.ps1 -Samples 3 -IntervalSeconds 10
Use the script's TotalMB as the baseline. The Windows v1 budget is wox + wox-ui <= 200 MB, using private working set, not RSS, commit size, or system memory percent.
/Users/qianlifeng/Projects/Wox/.agents/skills/wox-memory-debug/scripts/sample-wox-memory-macos.sh --samples 3 --interval 10
Use the script's TotalMB as the baseline. macOS uses vmmap -summary Physical footprint, which is the closest shell-accessible match for Activity Monitor's Memory column and Wox's processmemory.GetProcessMemoryBytes darwin path. Do not compare macOS footprint directly with Windows private working set; compare macOS runs with macOS runs.
If debugger-launched process names do not match, pass explicit PIDs:
/Users/qianlifeng/Projects/Wox/.agents/skills/wox-memory-debug/scripts/sample-wox-memory-macos.sh --pid 1234 --pid 5678 --samples 3 --interval 10
Use the first matching branch; do not optimize before attribution.
| Signal | Check next |
|---|---|
| Go core is high | Use the dev-only memory_profiling system command, inspect %USERPROFILE%\.wox\memory.prof, then run go tool pprof from wox.core. |
| Flutter UI is high and Dart heap is high | Attach Flutter DevTools or VM Service Memory view, compare Dart heap before/after hiding, then inspect retained controllers/widgets. |
| Flutter UI is high but Dart heap is modest | Inspect native/cache owners: WebView cached sessions, preview controllers, image cache, screenshot/session state, settings/onboarding state. |
| macOS total is high after WebView previews | Check whether memory is in wox-ui footprint first, then inspect WKWebView/WebContent helper processes separately if the user asks to include WebKit child processes. |
| Total only grows after specific previews | Start from WoxWebViewUtil, platform WebView sessions, and file preview renderers before touching launcher layout. |
| Total only grows after queries | Check result icons/images, plugin result payloads, and query result cleanup before changing global caches. |
wox_memory Glance item in wox.core/plugin/system/glance/glance.go.WoxApi.onUIReady() so core can attribute wox-ui.wox.core/util/processmemory/process_memory_windows.go; it intentionally uses private working set to match Task Manager's default Memory column.wox.core/util/processmemory/process_memory_darwin.go; it intentionally uses process footprint to match Activity Monitor's Memory column more closely than RSS.memory_profiling in wox.core/plugin/system/sys/sys.go.%USERPROFILE%\.wox\log\wox.log and %USERPROFILE%\.wox\log\ui.log on Windows, or ~/.wox/log/wox.log and ~/.wox/log/ui.log on macOS.