diff --git a/src/switcher/state/Applications.swift b/src/switcher/state/Applications.swift index e17ed83d..0f7b6da6 100644 --- a/src/switcher/state/Applications.swift +++ b/src/switcher/state/Applications.swift @@ -211,6 +211,10 @@ class Applications { let pid = tApp.processIdentifier AXCallScheduler.shared.removeEntry(key: "pid-\(pid)") AXCallScheduler.shared.removeEntries(withPrefix: "pid-\(pid)-") + // one-shot subscription keys (see Application.observeEvents) use the `sub-app-` prefix, which + // the `pid-` cleanup above misses; strip them here too or they leak 6 entries per app. + AXCallScheduler.shared.removeEntry(key: "sub-app-\(pid)") + AXCallScheduler.shared.removeEntries(withPrefix: "sub-app-\(pid)-") AXCallScheduler.shared.removeUnresponsivePid(pid) } App.refreshOpenUiAfterExternalEvent([]) diff --git a/src/switcher/state/Windows.swift b/src/switcher/state/Windows.swift index 463bc54d..922eb7d3 100644 --- a/src/switcher/state/Windows.swift +++ b/src/switcher/state/Windows.swift @@ -460,6 +460,10 @@ class Windows { for w in windows { if let wid = w.cgWindowId { AXCallScheduler.shared.removeEntries(withPrefix: "wid-\(wid)-") + // one-shot subscription keys (see Window.observeEvents) use the `sub-win-` prefix, so the + // `wid-` cleanup above misses them; strip them here too or they leak 6 entries per window. + AXCallScheduler.shared.removeEntry(key: "sub-win-\(wid)") + AXCallScheduler.shared.removeEntries(withPrefix: "sub-win-\(wid)-") Applications.windowAttributesThrottler.removeEntries(withPrefix: "\(wid)-") Applications.screenshotThrottler.removeEntry(withKey: "capture-wid-\(wid)") }