Skip to content

A row's kept size leaves the sizes kept under its key when it leaves its row - #74

Merged
trissim merged 1 commit into
mainfrom
claude-a/row-size-leak
Nov 22, 2026
Merged

trissim merged 1 commit into
mainfrom
claude-a/row-size-leak

Conversation

@trissim

@trissim trissim commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

RowDocumentDelegate kept every row size it ever measured under its preparation key: removing a row, changing it or measuring it again cleared the row's slot and not the per-key list.

After a finger scroll back through a long Toad thread: 171,302 RowSize (each with a QFont) for 4,436 rows, 79% of the 924,563 objects the collector walked; a full collection 396 ms, four of them stopping the GUI thread for 158-321 ms. With this: 234,903 objects, 74 ms.

Tests: tests/test_virtual_rows.py, 12 passed (one new).

🤖 Generated with Claude Code

https://claude.ai/code/session_016gZLdx92gKjvnNKianjAXG

…its row

RowDocumentDelegate keeps each row's measured size twice: in the row's slot
(`_row_sizes`) and under its preparation key (`_row_size_keys`, which
`_moves_rows` reads when a row's formatting arrives). rows_removed,
rows_data_changed and a new measure of the same row cleared or replaced the
slot and left the size under the key, so a list that pages rows in and out
held every size it had ever measured.

After a finger scroll back through a long Toad thread (255 pages through a
240-row window): 171,302 RowSize, each with its QFont, and about 389,000
tuples, for 4,436 rows: 79% of the 924,563 objects Python's collector
walked. A full collection took 396 ms and four of them stopped the GUI
thread for 158-321 ms during the scroll, on a desktop. With this: 234,903
objects, a full collection 74 ms.

`_unkeep` takes a size out from under its key; the three places a size
leaves its slot call it.

Tests: tests/test_virtual_rows.py, 12 passed (new: rows changed and measured
again 50 times, and removed, keep one size each under their keys).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gZLdx92gKjvnNKianjAXG
@trissim
trissim merged commit d87900b into main Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant