Skip to content

Deduplicate rows in table reporter with identical displayed fields#892

Open
abhiojha8 wants to merge 1 commit intobloomberg:mainfrom
abhiojha8:fix/table-reporter-dedup
Open

Deduplicate rows in table reporter with identical displayed fields#892
abhiojha8 wants to merge 1 commit intobloomberg:mainfrom
abhiojha8:fix/table-reporter-dedup

Conversation

@abhiojha8
Copy link
Copy Markdown

Issue number of the reported bug or feature request: #857

Describe your changes

The table reporter creates one row per AllocationRecord but only displays the top stack frame (max_stacks=1). Records with different full call stacks that map to the same displayed top frame appeared as duplicate rows in the HTML table.

This change aggregates records in TableReporter.from_snapshot() by their displayed key (tid, allocator, top_frame), summing size and n_allocations. No data is lost — the totals are preserved exactly.

Additionally, this adds a --split-threads option to the table command, matching the flamegraph reporter's existing flag. By default threads are merged; --split-threads keeps them separate.

Closes: #857

Testing performed

  • All 630 tests pass (including 7 new unit tests and 1 updated integration test)
  • Verified on the exercise_3/lru_cache.py tutorial: 21 leaked allocation records that previously produced 21 rows (with 18 visual duplicates) now correctly produce 3 deduplicated rows with identical size/allocation totals
  • Pre-commit hooks all pass (ruff, black, isort, prettier, rstcheck, etc.)

The table reporter creates one row per AllocationRecord but only
displays the top stack frame. Records with different full call stacks
mapping to the same top frame appeared as duplicate rows.

Aggregate records sharing the same (tid, allocator, top_frame) key,
summing size and n_allocations. Also add --split-threads option to
the table command, matching the flamegraph reporter.

Signed-off-by: Abhi Ojha <abhiojha8@gmail.com>
@pablogsal
Copy link
Copy Markdown
Collaborator

Screenshot 2026-03-31 at 19 16 27 Something is very wrong here ....

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.

Duplicate entries in memray table --leaks reporter.

2 participants