title: massive memory leak in ios UIWebView
body: <p>looking for mem leaks elsewhere in our system, I created a 20 MB web page with a meta refresh tag. the idea was to move a lot data through our datapath code to confirm mem stability.</p>
  
  <pre><code>&lt;html&gt;
  &lt;meta http-equiv="refresh" content="1"&gt;
  &lt;body&gt;
  &lt;div style="border: 1px solid red"&gt;
      Content loading
  &lt;/div&gt;&lt;!-- 20mb worth of comments --&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>what I found was the uiwebview displaying that meta refresh page leaks memory very, very fast. the app memory hits 300mb in about 2 minutes and gets shot on a low mem warning, even when our code is not in play.</p>
  
  <p>I have stopped the refresh loading and tried to dealloc the webview.</p>
  
  <p>I have tried loadurl:"about:blank", loadhtml:"", javascript document close.</p>
  
  <p>I also tried writing a recursive removeFromSuperview and removeFromParentViewController, reading that the private scrollview in the webview is a memory problem,  but that memory is never freed. I can't seem to find a reliable way to close, dealloc a webview when we are done with it.</p>
  
  <p>We have lived with a slow rate of webview leaking for quite a while and really want to find a way of assuring a webview can be fully cleaned up when we are done with it. We recently converted the app to ARC which did not change the memory rate.</p>
  
  <p>I am considering trying a recursive loop through all the objects in the webview and see if they can be freed. instruments shows 20 mb of cfdatas, alive, for each refresh of the 20MB page, but does not show them as leaks. if i only deliver the response header and done to the urlprotocol client we run stably so was ale to confirm the memleaks in the rest of the data path, but this is such a dramatic test case result am hoping to find a webview mem leak solution once and for all. </p>
  
  <p>Does any one have any better ideas or has anyone tried recursing through the objects in a uiwebview? </p>