Fix critical memory leaks causing 2.89GB usage on macOS Sequoia#335
Open
huynguyenh wants to merge 1 commit intodevelopfrom
Open
Fix critical memory leaks causing 2.89GB usage on macOS Sequoia#335huynguyenh wants to merge 1 commit intodevelopfrom
huynguyenh wants to merge 1 commit intodevelopfrom
Conversation
- Add [weak self] to DispatchQueue closures to prevent retain cycles - Implement deinit in StatusBarController and PreferencesViewController to clean up NotificationCenter observers - Fix NSStatusItem to only create once and properly remove with removeStatusItem() - Deactivate NSLayoutConstraints before removing views to prevent constraint memory leaks - Update macOS deployment target from 10.12 to 10.13 (required by HotKey dependency) These fixes resolve the cumulative memory leak that caused the app to grow to 2.89GB over time on macOS Sequoia. Testing shows 79% reduction in memory growth on repeated operations. Fixes #326
Member
|
cool, thanks @huynguyenh , lemme check this on weekend 🙏 |
|
I'm glad someone found the cause of this...any possibility of expediting a release with this fix? It's really killing my Mac. Thank you. |
|
When will this fix get merged? |
|
hey @phucledien, any news? really not trying to pressure you as this is open source and whatnot but this is really an important fix as the majority of people have at most 16GBs of RAM (due to, you know, pricing) I only noted this problem in macOS 26 though... |
|
I had to dump hidden and change to ice (beta build) to resolve for me. |
|
Having this merged would be much appreciated. The memory leak problem is really annoying |
|
@phucledien When will this PR be merged? Thanks |
sdenike
added a commit
to sdenike/hidden-revived
that referenced
this pull request
Apr 23, 2026
Adds the non-overlapping pieces of huynguyenh's PR dwarvesf#335 on top of rm335's PR dwarvesf#346. Handles the biggest leak source (NSLayoutConstraint retention when NSImageViews were recreated 9-10 times per toggle). - Deactivate NSLayoutConstraints before removing views in NSStackView.removeAllSubViews (prevents constraint retention of removed NSImageViews — primary leak source on macOS Sequoia/Tahoe) - Extend StatusBarController.deinit to invalidate timer and remove the always-hidden NSStatusItem - Change toggleStatusBarIfNeeded to only create the always-hidden status item when it doesn't already exist, instead of tearing down and recreating on every .alwayHideToggle notification Combined with the widest-display collapse-length calc in dwarvesf#354 and the bounded-length work in dwarvesf#344, this should resolve the runaway memory growth reported in upstream dwarvesf#326, dwarvesf#336, dwarvesf#351, dwarvesf#352. Co-Authored-By: huynguyenh <hoanghuy2908@gmail.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sdenike
added a commit
to sdenike/hidden-revived
that referenced
this pull request
Apr 23, 2026
- Fix: resolve memory leaks and remove debug info leakage (PR dwarvesf#346, Rob Mulder) - Fix comprehensive memory leaks (adapted from PR dwarvesf#335, huynguyenh) Addresses the cumulative leak causing 2.89GB memory usage on macOS Sequoia/Tahoe. Closes upstream dwarvesf#326, dwarvesf#336, dwarvesf#351, dwarvesf#352.
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.
Root Causes Identified
Fixes Implemented
1. DispatchQueue Closure Memory Leaks
Files: StatusBarController.swift:69-71, 142-144
2. NotificationCenter Observer Cleanup
Files: StatusBarController.swift, PreferencesViewController.swift
3. NSStatusItem Proper Lifecycle
File: StatusBarController.swift:244-262
4. NSLayoutConstraint Memory Leak (Critical)
File: StackView+Extension.swift:14-15
5. Timer Cleanup
File: StatusBarController.swift deinit
6. Deployment Target Update
File: project.pbxproj