Huge WebKit leak from iPhone OS 1.0 finally fixed in 2.2?

Like many other third-party apps, as well as Mobile Safari itself since iPhone OS 1.0, Instapaper can sometimes force-quit frequently after a lot of heavy use until after a reboot. (It’s not technically a crash – the iPhone OS runs out of memory and forces the app to quit, but the app goes through its clean shutdown procedure, which is why Instapaper Pro is always able to save your position.)

The symptoms are always the same: you’ll be reading an article, not doing any other actions, possibly not even scrolling, and the screen will go all-black for about 3 seconds, then return you to the home screen.

I’ve been battling this problem since the beginning, and my best guesses have led me to believe that it’s a memory leak in WebKit, the Apple component for rendering web pages in Safari and any third-party app that uses UIWebView (which is nearly all of them that render text with mixed formatting or inline images). The leaked memory persists after an application closes, possibly because it’s in a system-wide shared WebKit layer. That’s why a reboot always fixes it for a while.

In my testing with iPhone OS 2.2 so far, I haven’t been able to make the crash happen. I can still get the OS to issue low-memory warnings while reading long pages, but WebKit is then able to free enough memory that the force-quitting doesn’t follow.

I’m continuing aggressive testing, but so far, it appears that the problem is either significantly improved or eliminated. I’m optimistic on this one, and very happy that Apple has finally found and fixed this bug.

Related Posts