Repository navigation
Bound Stet's memory: layout cache, keystroke floods, image textures - #6
Merged
Merged
Conversation
Every edit to a long line left another shaped copy in the cache, and copies were only dropped past 3000 entries. A 330 KB line cost ~100 MB a copy, so typing in it reached 53 GB. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s drawn Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…sizes Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Stet reached ~50 GB after editing a very long line. This bounds every cache that grew without limit.
Fixes
66dd5ea): saved line layouts were capped only by count (3000). A laid-out line costs ~200–400 B per character, so a 330 KB line is ~100 MB per copy, and every edit kept another one. The cache now also clears once the saved text passes 1 MB.77f1c29,6142c69): when typing outruns redraws, every key made a new copy and nothing was cleared until the next redraw. Copies of lines ≥16 KB are now dropped as each key is typed, keeping the 2 most recent. A line the current redraw is already using is never dropped.ceba93f): GPU textures were never freed (each retouch save, closed doc and URL edit added one for good). Pictures not drawn for 60 s are freed, and textures are capped at 512 MB, but never anything drawn in the last 2 s. A picture that comes back reloads under a new id. Decoding is limited to 16384 px per side and 1 GiB of memory.Measured (peak memory footprint, release build)
Not fixed
data:URI keeps its full text there.Checks
cargo fmt --check,cargo clippy --workspace(0 warnings),cargo test --workspaceall pass. Unit tests cover the huge-line eviction and the texture eviction.🤖 Generated with Claude Code