views:

236

answers:

1

While there are already quite a few posts about leaks around UIWebView, mine is a bit more special, I believe, and thus deserves its own post here.

I see a reproducible large leak every time I load a Office document such as a Word or Excel file.

For instance, every time I display a 180KB .doc file, I get a 100KB leak. And that happens with both the simulator and an actual device, running OS 3.1.3.

The leak is not visible with the Leaks instrument but only by looking at the malloc instances via the ObjectAlloc instrument.

Here's a picture from the instruments trace:

alt text

I've also made a demo project, UIWebView-Leak.zip, so you can verify this yourself.

To see the leak, use the ObjectAlloc instrument, switch to the view where you see individual allocation objects, and sort by size so that you see the large ones in a group, just like in my picture above. Then view a Office document a few times and find the Malloc objects that keep staying "Live" even after the actual UIWebView has been freed.

Is this a known bug? Or is there any way I can avoid these leaks? I.e, have you successfully shown Office documents on an iPhone withing getting such leaks?

Note: I've reported this as a bug to Apple now, too (ID 7950594)

I am still waiting for someone (including Apple) to confirm this as a true leak or show why it isn't (i.e. that I do something wrong or make wrong assumptions)

+1  A: 

Turns out this is a real bug. Apple just told me that they've fixed it in an upcoming iPhone OS release. No workaround.

Thomas Tempelmann