Why Monterey’s Finder Find memory leak may not be fixed

One popular plan to avoid bugs introduced in a new major version of macOS is to use the final release of the last one. If you’re thinking of upgrading from Big Sur to Monterey when Apple releases macOS 13 this autumn/fall, you might like to think twice, as there’s a major memory leak which may well remain in Monterey for ever.

The bug

This memory leak affects all models of Mac, both Intel and M1, running any version of Monterey from its initial public release 12.0.1 to the latest update 12.4. As it affects one of the key features of the Finder, if you use the macOS GUI sooner or later you’re likely to come across it, and for some users it’s severe.

It only affects the Finder’s Find command (in the File menu), and doesn’t affect Spotlight itself, or third-party products which use Spotlight search, such as Find Any File or HoudahSpot. If you never ever use the Finder’s Find feature, then you can stop reading here, as you won’t encounter this bug.

When you set a Finder window into Find mode and start typing characters into its search box, the Finder launches an interactive search which homes in more narrowly as you type additional characters. What happens is that each of those searches is retained in memory, rather than being purged when a new search is started. The amount of memory used each time is determined by the number of ‘hits’ obtained at that moment. The more files that Mac has in its Spotlight database, the more hits are likely, and in some cases their number can be vast.

For example, let’s say you start typing the word syzygy, which should have very few hits. When you’ve just typed the first character s there are likely to be hundreds of thousands of hits. As those are being delivered to the Finder, its memory use grows rapidly. Add the second character y and the rate of memory use slows sharply, as there are far fewer hits, and after the third character z there should be even fewer.

What should happen is that, as the search is refined, the previous search is terminated and its partial search results are cleared from memory, which reduces the amount of memory used by the Finder. That doesn’t happen, though, and memory use continues to rise, never to be freed, even when you close that window to finish using Find.

Workarounds

If you’re only an occasional light user of the Find feature, you can use it without the Finder outgrowing your Mac’s memory, provided that your Mac generally has plenty of free memory. Instead of typing search terms one character at a time, you can paste in more specific text which is only likely to return less than a thousand hits, which should only consume around 5 MB each time. Any growth in the Finder’s memory use will then be small, and essentially unnoticeable.

The (literally) big danger is typing one character in and leaving the search to run: do that once, and the Finder’s memory use could readily rise into several GB. When the Finder’s use of memory grows too high for your Mac, before it starts hitting performance, open the Force Quit dialog by pressing Command-Option-Escape, select the Finder there, and click the button to Relaunch it.

memory06

If you can’t be so disciplined, or rely on Find frequently, or if your Mac has more limited physical memory, then there are three main options.

For straightforward searches, use Spotlight from the menu bar, which doesn’t appear to have any such problem.

For more intensive file searches, look at Thomas Tempelmann’s Find Any File (FAF), which costs around $/€/£ 6 direct or in the App Store. This is an excellent utility which does a great deal more than Finder’s Find ever will.

spotplus03

For more sophisticated Spotlight search, including file metadata and contents, HoudahSpot is more expensive, at around $/€/£ 32, is by far the most powerful Spotlight-based search utility, and worth every penny.

spotplus04

Neither FAF nor HoudahSpot has any memory leak, and both work excellently in Monterey.

Why this may not be fixed

This memory leak has been reported to Apple, and is the only significant reproducible memory leak known to remain in Monterey. However, it looks as if fixing it requires more extensive surgery. This is because it involves both Spotlight, whose searches appear to continue consuming CPU and memory after they should have been cancelled, and the Finder, which appears unable to free the memory from cancelled searches.

macOS has a track record of leaving well-known bugs in final major releases when more extensive work is required to fix them. Among those was failure in the DAS/CTS dispatching system which caused automatic Time Machine backups to fail in Sierra, APFS support for Fusion Drives in High Sierra, and painfully slow Time Machine backups in Catalina. Each of those was only fixed in the next major release of macOS. Of course I hope I’m wrong, and this memory leak gets fixed in 12.5, but the chances are falling.

One of the penalties with using the last release of the previous major version of macOS is that, while it will still get two years of security updates, it won’t get any other bugs fixed. If you couldn’t live with this or any other bug left in the final version of Monterey before the release of macOS 13, then it isn’t going to prove a good choice.