Repository navigation
Client: limit warm session residency by estimated size - #139
Open
katulevskiy wants to merge 3 commits into
Open
katulevskiy wants to merge 3 commits into
katulevskiy wants to merge 3 commits into
Conversation
The warm-session cap counted sessions, so six 5MB chats stayed resident on a phone as readily as six tiny ones. Byte-based residency lived in the old Swift store, which is gone; the Rust core only had the count cap. evict_sessions now also evicts least-recently-used detached, quiet sessions until the estimated resident total (all open sessions, including pinned ones) fits a 32MB budget. The count cap stays as an upper bound. The most recently used session is never picked, so a session that was just opened (not yet attached) survives even if it alone is over budget. The estimate is the desktop doc LRU's (snapshot bytes x 6, 512KB floor), hoisted into zeron-doc so both share it. The client sizes a doc by exporting a snapshot, cached per session until its op count changes. Evicted sessions are now flushed explicitly before being dropped, and outside the session-map lock, so a handle held elsewhere can't leave the debounced save pending.
Source: zeronsh#626 Source revision: 86952e4
Contribution Managerneeds triage · medium risk · untriaged Open review workspace · Revision Next actions:
This summary is maintained by the review app. Decisions and test evidence are recorded in the workspace; the app does not merge PRs. |
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.
Upstream mirror
Source: zeronsh#626
Original author: @katulevskiy
Original revision:
86952e4da77d8eb2f4ff70f5dd4c09ab2b9a3a86This PR is an isolated Contribution Manager pilot mirror. Its reviews, checks and merge state are separate from upstream. An empty
[skip ci]commit suppresses automatic bulk CI; the code tree matches the imported upstream revision.Summary
evict_sessionsstill applies the cap of 6 and now also evicts least-recently-used detached, quiet sessions until the estimated resident total fits a 32 MB budget. Pinned sessions (on screen, streaming, pending sends) count toward the total but are never evicted, and neither is the most recently used session.zeron-docso both share it, and the engine now calls it. The client sizes a doc by exporting a snapshot, cached per session until its op count changes.docs/memory-plan.mdtargets 150-250 MB for the whole app, 48 MB of which is already the attachment cache, so I'm happy to adjust the number.zeron-docandzeron-engineas well as the client. No UniFFI changes.