Draw the whole chain from a GC root, however long it is - #2954
Merged
Conversation
A chain past twenty steps was cut at the root end and the head row said "GC root: …, then … 14 steps" instead. That answers "what holds this?" with a count of the objects that would have said, in the one pane that exists to answer it, and there is no way from the count back to them. Chains get long. On the dumps in this repo the deepest are 499 steps (large-dump.hprof) and 1,518 (compose_leak.hprof), both walks down a linked structure, so this is not a rare shape. What the cut was protecting was the drawing, not the reading. Reading one is a heap dump read per step: 6 ms for the 499 and 12 ms for the 1,518, against a hover's budget of a hundred. Drawing was the problem — the pane was a Column in a verticalScroll, which composes every row, and a chain of 1,500 rows at four lines each never appeared at all: 60 s and nothing on screen. It is a LazyColumn now, so the pane composes the seven rows it has the height for and a chain of 500 steps takes the same 200 ms from the click as one of 20. The independent paths a stretch of a chain could have run instead lose their cut too, for the same reason: a way of holding an object that stops short is the same non-answer. A chain that long has almost no stretches in doubt anyway — the deep ones are linked lists, where every step dominates the object, one detour and 18 ms for the 499 and none for the 1,518. Co-Authored-By: Claude Opus 5 <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.
A chain past twenty steps was cut at the root end, and the head row said
GC root: …, then … 14 stepsinstead of the objects. That answers "what holds this?" with a count of the objects that would have said, in the one pane that exists to answer it, and there is no way from the count back to them. Independent paths — the other ways a stretch of a chain could have run — were cut at fifteen for the same non-reason.Chains get long: on the dumps in this repo the deepest are 499 steps (
large-dump.hprof) and 1,518 (compose_leak.hprof), both walks down a linked structure.What the cut was protecting was the drawing, not the reading:
Columnin averticalScroll, which composes every row, and a chain of 1,500 rows at four lines each never appeared at all — 60 s and nothing on screen. It is aLazyColumnnow: the pane composes the seven rows it has the height for, and a chain of 500 steps takes the same ~200 ms from the click as one of 20.Numbers came from throwaway tests over
large-dump.hprofandcompose_leak.hprof, deleted before this landed; they're recorded innotes/decisions.md.Tests: the core test that pinned the cut now pins the whole chain, and the UI test for a chain taller than its pane asserts the off-screen row doesn't exist rather than isn't displayed, which is what a lazy pane means.
shark-explorer-core:checkandshark-explorer-app:checkare green.🤖 Generated with Claude Code