fix: free the launch window's tab manager when it closes - #392
Merged
Merged
Conversation
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.
What this does
Closing the window that opens at launch no longer leaves its tabs, workspaces and splits in memory. After #390, every other window was freed on close, but the launch window left one full set behind each time.
Three things held it:
Sources/ProgramaApp.swift): the menu's button actions captured the window's tab manager and workspace, and SwiftUI keeps the menu around. The actions now look up the active tab manager when clicked, like the other menu items.Sources/ContentView+SidebarResizer.swift): teardown scheduled a deferred cursor release stored in view state. Once the view was gone, it never cleared, and it held the view and its tab manager. Teardown now releases the cursor right away.Sources/ProgramaConfig.swift): a Combine pipeline kept the last selected workspace. It now keeps only the workspace id and its directory publisher.Measured
Tagged Debug build,
heapcounts of Workspace / TabManager / BonsplitController / SidebarState, 8 s after each close.The one extra tab manager after a close is the spare that
PrimaryTabManagerStorekeeps for the next launch window, by design.Test plan