Fix unbounded memory growth in the log view #185
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/isaac-btw--AmericasLauncher!185
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-185"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Tuxeeee on GitHub · 2026-12-04 08:47 UTC · original
Tuxeeee:fix/log-undo-leak→main· +6 −0 · 1 files · 1 commits · merged 2026-12-04 10:52 UTCProblem
The launcher's memory use climbs steadily while it runs and never comes back down. After a long session with the game running, I saw it at about 8 GB, with the game already closed.
AnsiLogBoxderives fromRichTextBox, andRichTextBoxkeeps undo history by default with no limit (IsUndoEnabled = true,UndoLimit = -1). EveryAppendLinescall runs insideBeginChange()/EndChange(), so each batch of log lines is stored as an undo unit. When the box trims old lines to stay underMaxChars/MaxLines, removing those paragraphs is recorded as an undo unit too, which keeps them alive. The visible log stays bounded, but everything ever written to it stays in memory.Fix
Set
IsUndoEnabled = falsein theAnsiLogBoxconstructor. The log is read-only, so nothing uses undo. With undo off, trimmed paragraphs can be garbage-collected and the existing limits bound memory as intended.Testing
dotnet build -c Release), no new warnings.Possibly related, not changed here
_logQueueand_nvidiaLogQueueinMainWindoware drained at most 80 lines per 50 ms tick, and nothing limits their size. Output faster than that (about 1,600 lines/s) piles up in the queues. That's a separate, smaller issue, left out to keep this change minimal.