Reduce tray idle memory by unloading the main WebView#686
Open
F0RLE wants to merge 1 commit into
Open
Conversation
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.
Summary
This PR reduces idle memory usage when the main window is closed to the tray.
Instead of hiding the main Tauri window, the app now destroys the main WebView when the close behavior is set to minimize to tray. The Rust backend, tray icon, and background services remain alive, and the main window/WebView is recreated on demand when the user opens the app from the tray or navigates from tray menu actions.
Why
Previously, closing the window to the tray only called
hide(), so the React frontend and WebView stayed loaded in memory even while the app appeared closed. This made the tray-only idle state much heavier than necessary.Changes
EmptyWorkingSetandSetProcessWorkingSetSizemalloc_trim(0)malloc_zone_pressure_reliefValidation
npm run typecheckcargo check -p cockpit-toolsNotes
The memory trimming APIs are best-effort requests to the OS/runtime allocator. They reduce the resident working set where possible, but exact idle memory values are still controlled by the operating system.