UIWebView has unacceptable heap growth

Originator:tassinari
Number:rdar://16300808 Date Originated:3/12/2014
Status:OPEN Resolved:NO
Product:iOS SDK Product Version:7.1
Classification: Reproducible:YES
 
Summary:
When a UIWebView is created and put in a navigation controller, then presented modal and dismissed.  It should clear all memory after it deallocates but it's adding 200-500kb in heap growth every time it's presented.

Steps to Reproduce:
1. Open the attached test project
2. Run in Instruments with allocations
3. Get a baseline in instruments, mark the generation
4. Press test in the app, wait till the page loads then close it.
5. Mark the generation in Instruments
6. Repeat as needed

Expected Results:
I would expect little to no heap growth once the web view deallocates.  If it is caching the url request, that should go too.  I've cleared the NSURL cache and that has no affect.

Actual Results:
The heap grows by about 200-500 kb, I'm seeing 1mb in a real app.

Version:
iOS 7.0 and 7.1 with Xcode 5.1

Notes:
Exact problem on stack overflow: http://stackoverflow.com/questions/20234462/uiwebview-leaks-js-garbage-collector-webcore-vms

Sample project on bit bucket: https://bitbucket.org/tassinari/mtwebviewtest

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!