Repository navigation
Conversation
The bus monitor kept every frame it received, so its memory grew without bound on a busy bus, to several gigabytes after an hour. RealtimeLogWidget takes an optional row limit: once the table grows beyond it, the oldest rows are removed in one bulk operation per redraw. The limit is shown next to the row count and can be edited there; a lower limit applies immediately. Its arrows step through multiples of 10000, down to the minimum of 1000. The queue of items waiting to be shown is now a collections.deque instead of a queue.Queue. A deque with a maximum length drops its oldest item when a new one is added to it while full, so items queued while the display is paused are capped at the row limit, keeping the newest ones, which are the ones that would remain in the table anyway. A queue.Queue with a maximum size refuses new items instead, which would keep the oldest ones. Items are added and taken on the Qt main thread, and append() and popleft() are atomic in CPython regardless, so the locking of queue.Queue is not needed. The bus monitor uses a limit of 200000 rows. Other users of the widget are unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
i'm adding this because if the monitor window is left open and running for a long enough amount of time, it becomes a system resource hog and ends up causing grief. This doesnt resolve the issue completely however, and there is a follow up PR. See: #146 There's an issue that was previously raised for it here: #35 A follow up PR adds ability to log traffic to a |
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.
Summary
The bus monitor kept every frame it received, so on a busy bus its memory grew without bound. This caps the table at 200,000 rows, editable from the bus monitor toolbar.
RealtimeLogWidget(..., max_rows=None) # None: unlimited, as before _redraw move queued items into the table + _trim_rows: remove the oldest rows beyond max_rows, in one bulk removal - _queue: queue.Queue # unbounded while paused + _queue: collections.deque(maxlen=max_rows) # drops the oldest when full + SteppableSpinBox "max 200,000" # next to the row count; lowering it trims immediately BusMonitorWindow - RealtimeLogWidget(...) + RealtimeLogWidget(..., max_rows=200000)collections.deque: with a maximum length it drops its oldest item when full, so frames queued while the display is paused are capped at the limit and the newest are kept. Aqueue.Queue(maxsize)would refuse new items and keep the oldest instead.SteppableSpinBoxsteps to multiples of its step size, so the arrows go 1,000 → 10,000 → 20,000 rather than 1,000 → 11,000 → 21,000.RealtimeLogWidget, passes no limit and is unchanged.Evidence
Before: two bus monitors left open on a live bus, measured with
/proc/<pid>/smaps_rollup: 3.4 GiB after 74 minutes and 3.9 GiB after 22 minutes, still growing ~4.4 MiB/s.After: frames fed into a bus monitor with the limit set to 20,000 (offscreen, on this branch):
Spin box stepping:
Merge Danger
Door: two-way
Revert the commit to restore unlimited rows.
Blast Radius: bus-monitor
Only the bus monitor gets a limit. Frames older than the newest 200,000 rows are no longer shown, and are lost from the table if the display is paused for longer than that; anyone relying on scrolling back further can raise the limit in the toolbar.
🤖 Generated with Claude Code