render: bound the blank entries in the glyph caches #450
No reviewers
Labels
No labels
priority/P0
priority/P1
priority/P2
release/v0.1.0
status/blocked
status/planned
type/bug
type/design
type/test-gap
type/tracker
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
natsukium/felis!450
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/glyph-406"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #406
Two client-side glyph caches grew without bound on glyphs that rasterize blank, whose keys PTY output chooses (char × OSC 66 sizing × style).
ShapeCachecounted only pixel bytes against its 16 MiB cap, and a blank bitmap has none. Each entry now also costs its key and bitmap header (size_of::<(key, GlyphBitmap)>()), so blanks count and are evicted like any other entry.GlyphIndex::slotscached blanks, and glyphs too large for an empty sheet, asNone. Only an atlas recycle cleared the map, and aNonetakes no atlas space. The index now countsNoneinserts, and pastBLANK_SLOT_MAX(4096) itretains only the placed slots. Lookups treat a missing key and a blank one the same way, so a sweep cannot change a frame, even for rows the incremental walk skips.Hit paths (
ensure,ShapeCache::get_or_insert_sized) are unchanged: the new work runs only on a miss, so no Criterion run was needed.Tests written first and failing before the fix:
glyphs::tests::distinct_blank_keys_keep_the_slot_map_under_the_blank_cap(had 4097 entries at the first overflow)glyphs::tests::dropping_blank_entries_keeps_placed_slots_and_the_atlastests::blank_bitmaps_count_against_the_byte_cap(felis-shaping; had 2048 blank entries under a 4 KiB cap)Docs: text-shaping.md "Cache", pipeline.md "Atlases", security-model.md "Resource exhaustion", REQ-1010, CHANGELOG (Fixed).
nix develop -c just checkpasses. The row_cache.rs file is not touched.