Repository navigation
Keep assistantd enabled: without it the simulator's Spotlight app leaks memory without bound - #59
Merged
Conversation
On a never-booted simulator slimmed offline, disabling com.apple.assistantd (the only vendor of com.apple.assistant.dictation) makes Spotlight's search header loop on dictation availability and leak memory without bound (~20-115 MB/s). Keep it enabled via the siri category's AlwaysEnabled, like gamed in MobAI-App#57; re-running `simslim on` repairs devices slimmed earlier. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Whoa, that's unexpected! Thanks for finding this, merging right away. |
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.
Problem
On a fresh iOS 26.4 simulator slimmed with
simslim on <udid> --except photos(simslim 0.11.0, iPhone 17 Pro, runtime 23E254a), the system Spotlight app (RuntimeRoot/Applications/Spotlight.app/Spotlight, which SpringBoard launches in the background at boot) grows without limit:xcrun simctl launch <udid> com.apple.Spotlight), about 115 MB/s;A stock simulator on the same Mac stays flat at about 285-306 MB.
Repro
What we measured. Peak RSS is in MB. Each run used a fresh device. "Background" is the 75 s after boot. "Foreground" is
simctl launchplus 25 s.--except photos--except photos,search(search kept)--except photos,siri(siri kept)--except photos --keep com.apple.assistantdcom.apple.assistantddisabled (1/170)--except photos*
[com.apple.siri:Client] -[AFPreferences _languageCodeWithFallback:] No language code saved, but Assistant is enabled, from Spotlight's main thread, up to 2,300 lines/s.Root cause
com.apple.assistantdis the only job that vends thecom.apple.assistant.dictationmach service. Without it, Spotlight's main queue gets stuck in a loop. A 2 ssampleof the leaking process shows all 1583/1583 main-thread samples inside this cycle:-[AFDictationConnection _tellSpeechDelegateAvailabilityChanged]fires.-[UIDictationController dictationConnnectionDidChangeAvailability:]posts a notification.-[SPUISearchHeader updateDictationButtonEnabledStatus]and-[SPUISearchHeader enableDictationIfRequired].-[UIKeyboardInputMode dictationLanguage],-[AFDictationConnection dictationIsAvailableForLanguage:synchronous:]andAFOfflineDictationLanguageForKeyboardLanguageintoAFPreferences.The leak only happens when the device has never booted with assistantd running. That is the normal case for
simslim onagainst a shutdown, never-booted device since the offline fast path (#49), because the very first boot is already slim. A device that booted stock once does not loop, even with assistantd disabled afterwards. This is probably why the bug went unnoticed.The flood of Siri language errors is a symptom, not the cause. Seeding
com.apple.assistant.backedup→Session Languageremoves the log lines, but Spotlight still reached 1183 MB.The
searchcategory is not involved: keeping it enabled still leaks.Stopping Spotlight.app is not a viable fix. It is a FrontBoard-launched app (
UIKitApplication:com.apple.Spotlight[…]), not a launchd label. It comes back on pull-down search or onsimctl launch.Fix
Move
com.apple.assistantdout of thesiricategory'sLabelsand into itsAlwaysEnabled, the same mechanism #57 used forgamedand thatsharingduses:simslim onagain re-enables it on devices slimmed by earlier versions.verifyreports it asextradrift until that happens.simslim profiles siriexplains why it is always on.The other 28 Siri and Intelligence daemons are still slimmed.
Cost: assistantd measures about 22-23 MiB phys_footprint (
simslim top) on iOS 26.4, on both stock and slim devices. Thesiriestimate (265 MB, measured on iOS 26.5) probably drops by about that much and should be remeasured. I left the number unchanged because I don't have a 26.5 runtime here.Other changes:
service_descriptions.go: removed assistantd's description, which the coverage test requires once it is no longer a Label.status_test.goandcmd/simslim/wizard_test.go: they used assistantd as "a siri label" and now usecom.apple.assistant_cdmd.Test
New
TestAssistantdStaysEnabledForSpotlight, modelled on the gamed regression test. It checks that assistantd is not slimmable, that the siri category gives a reason for keeping it, that a legacy disabled assistantd gets re-enabled, and that the other Siri daemons stay slimmable. It fails on the current profile (3 assertions) and passes with the patch.make checkpasses with Go 1.27.1 (go test, go vet, swift-format lint, zsh -n, plutil); gofmt is clean.Built binary (
go build ./cmd/simslimfrom this branch) vs the released 0.11.0, each on a fresh iPhone 17 Pro / iOS 26.4 device withsimslim on <udid> --except photos, Spotlight forced to the foreground and sampled every 2 s for 60 s, same session:Earlier runs with the released binary and the equivalent
--keep com.apple.assistantd:🤖 Generated with Claude Code