feat(desktop): disable WebKit page cache to trim renderer memory - #212
Open
loss-and-quick wants to merge 1 commit into
Open
feat(desktop): disable WebKit page cache to trim renderer memory#212loss-and-quick wants to merge 1 commit into
loss-and-quick wants to merge 1 commit into
Conversation
The Linux web view loads a single local SPA and never navigates back/forward, so WebKit's page cache — which keeps prior pages resident for instant back/forward — only holds dead weight. Turn it off through `with_webview()` in setup. Pull in `webkit2gtk` pinned to wry's version so `inner()` yields the matching `WebView` type.
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
Disable WebKit's page cache for the Linux desktop web view. The app loads a single local SPA and never navigates back/forward, so the page cache (which keeps prior pages resident for instant back/forward) only holds dead weight in the
WebKitWebProcess. It is turned off throughwith_webview()insetup, pulling inwebkit2gtkpinned to wry's version soinner()yields the matchingWebViewtype.Affected layer
crates/·src-tauri/— Rust core / backend / Tauri desktopVerification
Rust (
src-tauri/):cargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace— 67 pass; the lone failure isnet::tests::tcp_ping_fails_on_unreachable_host, an environment artifact on a host with the Kasumi transparent proxy active (its TUN intercepts the RFC 5737 TEST-NET address the test expects to be unroutable). It passes in an isolated network namespace (unshare -rn), and the diff does not touchkasumi-backend.frontend/src/generated/is unaffected.Measurement
Median
WebKitWebProcessresident set over 3 runs (real UI loaded, isolated session):≈ −47 MB RSS / −44 MB PSS, no UX cost (the app never uses back/forward).
Notes for reviewers
tauri://may shift the absolute numbers but not the delta.WEBKIT_DISABLE_COMPOSITING_MODE=1trims a further ~35 MB (median, ~83 MB off stock) by dropping GPU-accelerated compositing — left out because it carries a UX trade-off (CPU compositing) and belongs behind an opt-in "memory saver" toggle rather than always-on.