Yesterday I was having a discussion about which Apple apps use the new garbage collection feature of Objective-C 2.0 (the fobjc-gc switch).
One of the reasons this topic comes up in Microsoft circles is the fact that so few Microsoft desktop applications use the CLR. As you may be aware, there is a performance cost associated with running code in the CLR and garbage collection often gets painted as the chief offender.
I had heard that several Apple apps in 10.5 used this feature, but I had never followed up to know for sure. Yesterday I decided to take a look. Since I am a complete hacker, I decided not to ping the Apple lists and just see if there was a way to figure this out myself.
Based on my digging around (nm is your friend), I believe the following apps (of the subset I looked at in 10.5) use GC:
- Mail
- iChat
- Preview
- PhotoBooth
I looked at the iLife apps too, but none of them had the signs of GC. However, GC is a feature of 10.5 and iLife supports 10.4 — so that likely explains it.
I have to tell you and I have said this before at Microsoft, Apple did a very cool thing here. They had most apps on the same “unmanaged” memory allocator/scheme (ref count with autorelease) and then they shimmed in GC as an optional feature. Even more important (and far cooler in this world of a new framework every 10 minutes), is that Objective-C/NeXTStep/OpenStep/Cocoa has been around since the late 1980s and just getting better with age…