Repository navigation
Use far less memory while Syncer sits in the tray - #49
Merged
Merged
Conversation
The window stops refreshing while hidden, and Syncer and its web view hand their idle memory back to Windows a few seconds after the window hides.
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.
What
Syncer sat at ~420 MB working set in the tray (Syncer.exe + 6 WebView2 processes), almost all of it a window nobody was looking at.
internal/winx/trim.go,tray.go): 5 s after the window hides to the tray, and 45 s after a--traystart, Syncer runsdebug.FreeOSMemoryandEmptyWorkingSeton itself and its WebView2 children. Pages move to Windows' standby list and return on demand; nothing is closed or lost.frontend/src/lib/refresher.ts): the 15 s refresh timer and thechangedevent refetch pause while hidden and catch up when the window shows (windowevent,WindowHidden()binding).No data formats, sync, backup, conflict, API or account code changed.
Measurements (claude-dev, Windows 11, same release build method,
wails build; 60 s sample after settling)Working set / private bytes, WebView2 = 6 processes under Syncer.exe. Syncthing was already running (2 processes on this box, not started or configured by the run), so it is identical both times.
--tray)--background, nothing to back up here)Handles/threads unchanged (~600 handles, ~30 threads for Syncer; ~2.6k / ~132 for WebView2). The window-open numbers are equal within noise, as expected: the trim only runs while hidden. The background-run scenario had no folders to back up on this machine, so it only proves no regression at startup, not a heavy backup.
Not implemented (proposals)
MemoryUsageTargetLevel = Lowwhile hidden: not reachable through Wails v2's public API.GOMEMLIMITon the child it launches is possible but of little use at 40 MB per process.Verification
go test -short ./... && go test -short -tags personal ./... && npm --prefix frontend run check && npm --prefix frontend testexits 0. UI not visually changed.