Secret Lion Feature Revealed!

For whatever reason, I’m subscribed to the WebKit project commit feed. So I can see whenever a new change in pushed into the project. Sometimes those commits reveal things. Like one from yesterday. Commit 72356 simply states “Enable compaction support.” And it sets a single linker flag for the Mac parts of the project.

Stunning, isn’t it? It may seem insignificant, but the addition of heap compaction to the Objective-C garbage collector is likely a prerequisite for its addition to the iOS SDK. You read about heap compaction in a great answer to this StackOverflow question. Why would it lead to garbage collection on iOS? Given that all iOS devices are vastly more memory constrained than their Mac OS X counterparts and lack on-disk virtual memory, anything can optimize memory use, especially for “free” from a developer’s perspective, is a big win. Reducing memory fragmentation, and more importantly, being able to reuse the same memory addresses during the common alloc/dealloc cycle that most objects go through will likely allow the Objective-C garbage collector to have the performance needed for Apple to enable it in iOS. As well, it’s continued evidence of Apple’s investment in Objective-C as the Mac OS X and iOS language of choice. It’s likely more details of this feature will be uncovered in the open source Objective-C runtime Apple produces, as well as the clang compiler project. A small but important feature we’ll see in Lion next year.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">