Skip to content

Issue #593: add regression test for cursor leak and stale tooltip on live charts#1012

Merged
timmolter merged 1 commit into
developfrom
issue-593-cursor-live-chart-regression-test
Jul 20, 2026
Merged

Issue #593: add regression test for cursor leak and stale tooltip on live charts#1012
timmolter merged 1 commit into
developfrom
issue-593-cursor-live-chart-regression-test

Conversation

@timmolter

Copy link
Copy Markdown
Member

Closes #593.

Analysis

Both symptoms reported in #593 had a single cause: Cursor held a dataPointList of screen-space points that was appended to on every repaint and never cleared.

  • ISSUE 1 (memory leak) — a live chart repainting a few times a second grew the list without bound, matching the reporter's "gigabytes of Cursor$DataPoint".
  • ISSUE 2 (wrong tooltip) — stale points from earlier frames still sat at their old screen coordinates, so an old point could match the mouse and win, producing the "old timestamps / jumps backwards" behavior.

Both were already fixed as a side effect of the two-phase PlotInteractionData refactor, not by a targeted fix. Interaction data is now cleared at the start of each paint in PlotContent_.paint(), and Cursor.setData() rebuilds its own list from it. Nothing guarded against a regression, hence this PR.

Changes

  • Add CursorLiveChartTest — two tests over 30 live updates: one asserts the point lists stay bounded (leak), one asserts the label reflects the current frame (stale tooltip). Headless, no XChartPanel, following the existing CursorZoomTest pattern.
  • Make Cursor.dataPointList package-private so the test can assert on it.
  • Fix stale javadoc in TestForIssue593 that referenced a cursor.clearDataPoints() method that no longer exists.

Verification

Confirmed the test is a genuine regression test by temporarily removing dataPointList.clear() — it fails with exactly the reported symptoms:

Expected size: 20 but was: 40
expected: "120" but was: "120, 120"

Fix restored; full xchart suite passes and xchart-demo compiles.

🤖 Generated with Claude Code

The cursor's memory leak and stale tooltip on live charts were both fixed
by the two-phase PlotInteractionData refactor, but nothing guarded against
a regression. Add a headless test covering both symptoms across repeated
live updates: the point lists must not grow, and the label must reflect
the current frame.

Also fix stale javadoc in TestForIssue593 that referenced a
cursor.clearDataPoints() method that no longer exists.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@timmolter
timmolter merged commit ee96de4 into develop Jul 20, 2026
1 check passed
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.

Cursor in LiveChart: Memory Leak and wrong tooltip

1 participant