Fix memory leak from recursive print warning flood in hs.ipc#3845
Open
dmgerman wants to merge 1 commit intoHammerspoon:masterfrom
Open
Fix memory leak from recursive print warning flood in hs.ipc#3845dmgerman wants to merge 1 commit intoHammerspoon:masterfrom
dmgerman wants to merge 1 commit intoHammerspoon:masterfrom
Conversation
The printReplacement recursion guard was using log.w() to warn about recursion, which itself triggers print, causing a cascade of warnings. A single hs -c command could generate 86,863 warning lines, and over 9+ hours of usage, this caused memory to grow from ~140 MB to 1.4+ GB. Changes: - Add warnedRecursionInstances table to track warned CLI instances - Warn only once per instance using originalPrint (not log.w) - Clean up tracking tables when instances unregister
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3845 +/- ##
==========================================
+ Coverage 27.22% 27.39% +0.17%
==========================================
Files 191 191
Lines 51537 51537
==========================================
+ Hits 14032 14121 +89
+ Misses 37505 37416 -89 🚀 New features to boost your workflow:
|
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.
The printReplacement recursion guard was using log.w() to warn about recursion, which itself triggers print, causing a cascade of warnings about the recursion. A single hs -c command could generate thousand of warning lines (which make the memory print of hammerspoon to grow extremely fast).
Changes: