From 84a5200e234d261080259849ad283b181111e878 Mon Sep 17 00:00:00 2001 From: Kirill Ignatev Date: Fri, 9 Oct 2026 19:36:47 -0400 Subject: [PATCH 1/2] tests: Check the live TUI table before toggling thread merging The live TUI starts in merged mode, so its table should show every thread Signed-off-by: Kirill Ignatev --- tests/unit/test_tui_reporter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/test_tui_reporter.py b/tests/unit/test_tui_reporter.py index efaeb9aa26..970352ce95 100644 --- a/tests/unit/test_tui_reporter.py +++ b/tests/unit/test_tui_reporter.py @@ -772,7 +772,7 @@ async def run_test(): datatable = pilot.app.screen.query_one(DataTable) - for key in ("m", ">", "m", "<", "m", "<"): + for key in ("", "m", ">", "m", "<", "m", "<"): await pilot.press(key) functions.append(datatable.get_cell_at(Coordinate(0, 0)).plain) labels = extract_label_text(app) @@ -782,8 +782,8 @@ async def run_test(): async_run(run_test()) # THEN - order = [0, 1, 2, 2, 1, 0] - merged = [False, False, True, True, False, False] + order = [2, 0, 1, 2, 2, 1, 0] + merged = [True, False, False, True, True, False, False] assert functions == ["abc"[i] for i in order] assert tids == [ "TID: *" if all else f"TID: {hex(i + 1)}" for i, all in zip(order, merged) From 579c0fdd5ed3bf63e31f94baf0c5a3a4ec008c5d Mon Sep 17 00:00:00 2001 From: Kirill Ignatev Date: Fri, 9 Oct 2026 19:36:47 -0400 Subject: [PATCH 2/2] tui: Merge threads in the live table from the start The table only showed the first thread until merging was toggled. Signed-off-by: Kirill Ignatev --- news/1050.bugfix.rst | 1 + src/memray/reporters/tui.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 news/1050.bugfix.rst diff --git a/news/1050.bugfix.rst b/news/1050.bugfix.rst new file mode 100644 index 0000000000..8d60ee11b6 --- /dev/null +++ b/news/1050.bugfix.rst @@ -0,0 +1 @@ +Fix the live mode TUI showing only the first thread's allocations until merging was toggled, even though it starts in merged mode. diff --git a/src/memray/reporters/tui.py b/src/memray/reporters/tui.py index 96042e2579..a252b36c31 100644 --- a/src/memray/reporters/tui.py +++ b/src/memray/reporters/tui.py @@ -221,7 +221,7 @@ class AllocationTable(Widget): sort_column_id = reactive(default_sort_column_id) snapshot = reactive(_EMPTY_SNAPSHOT) current_thread = reactive(0) - merge_threads = reactive(False, init=False) + merge_threads = reactive(True, init=False) columns = [ "Location",