Skip to content

feat(desktop): disable WebKit page cache to trim renderer memory - #212

Open
loss-and-quick wants to merge 1 commit into
mainfrom
feat/desktop-webkit-page-cache
Open

feat(desktop): disable WebKit page cache to trim renderer memory#212
loss-and-quick wants to merge 1 commit into
mainfrom
feat/desktop-webkit-page-cache

Conversation

@loss-and-quick

Copy link
Copy Markdown
Owner

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 through with_webview() in setup, pulling in webkit2gtk pinned to wry's version so inner() yields the matching WebView type.

Affected layer

  • crates/ · src-tauri/ — Rust core / backend / Tauri desktop

Verification

Rust (src-tauri/):

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo test --workspace — 67 pass; the lone failure is net::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 touch kasumi-backend.
  • Codegen drift: no Rust types/defaults changed, so frontend/src/generated/ is unaffected.

Measurement

Median WebKitWebProcess resident set over 3 runs (real UI loaded, isolated session):

build RSS PSS
stock 378 MB 265 MB
page cache off 331 MB 221 MB

−47 MB RSS / −44 MB PSS, no UX cost (the app never uses back/forward).

Notes for reviewers

  • Measured on Wayland + nvidia (patched GTK3) via a dev-mode instance served locally; production tauri:// may shift the absolute numbers but not the delta.
  • A larger lever exists but is not included here: WEBKIT_DISABLE_COMPOSITING_MODE=1 trims 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.

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.
@github-actions github-actions Bot added the backend Rust core/backend/desktop (crates/, src-tauri/) label Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Rust core/backend/desktop (crates/, src-tauri/)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant