OS X: Finder crashes every 20 seconds

Now this was a weird one. The user said he was unable to work because every 20 seconds, his programs in which he was working were hidden and the desktop would show up. He told me he already rebooted the machine. So I opened the End Tasks dialog with Cmd-Alt-Esc and forced a finder restart. Still the same behavior.

So I opened the console app to see if there was anything in the log files. There was a log entry indeed:

Aug 12 13:18:58 my-mac-g5-7 /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder: CGBitmapContextCreateInfo: unable to allocate 1073676288 bytes for bitmap data
Aug 12 13:18:59 my-mac-g5-7 crashdump[589]: Finder crashed
Aug 12 13:18:59 my-mac-g5-7 crashdump[589]: crash report written to: /Users/My/Library/Logs/CrashReporter/Finder.crash.log
Finder(590,0x183a000) malloc: *** vm_allocate(size=1073680384) failed (error code=3)
Finder(590,0x183a000) malloc: *** error: can't allocate region
Finder(590,0x183a000) malloc: *** set a breakpoint in szone_error to debug

So I did a google search for these error messages, but I didn’t come up with useful results.

Then I fired up the activity monitor app to see if there’s anything suspicious. And guess what, there was! The finder ate up 2GB of RAM (3GB are installed) and that number even grew up to 2.5GB, then the finder crashed again.  Memory usage was down to 99.99MB, but it started growing immediately, and after 20 seconds, it reached the critical size again and the finder crashed once more.

I was wondering why the finder consumed so much memory. I asked the guy working with that machine if he changed his wallpapers recently, but he didn’t.

Then I noticed that, while the finder’s memory usage increased, one of the adobe illustrator files on his desktop changed its icon from the .ai file icon to a preview. And another one. He had about ten of these Adobe Illustrator files on his desktop. Then the finder crashed again, all icons vanished for a second and then, when they reappeared, all had the default .ai system icon again.

So the cause for the finder crashes had something to do with the finder generating previews from .ai files. I created a new folder on the desktop and moved all of the .ai files into it. The problem was gone.

Very interesting. I opened that folder, clicked on the “bar view” icon (however that’s called), where you get that little information bar on the right when you select a file. I clicked the first .ai file, after a few seconds I saw a preview. I tried the second, preview came as well. Tried the third file, and while generating the preview, after like 10 seconds, the finder crashed.

So, after all, I think I found a bug. It may be an interesting fact that all of the ~10 .ai files were 29MB in size all together, so it’s not like the finder was trying to generate previews for 2GB files or something. A 3MB file was enough to make the finder crash.

Leave a Reply