2013-07-29 18 views
1

我發現當web視圖已經發布時,我的應用程序會保存很多內存。因爲我的應用程序需要加載很多網頁。這是我在dealloc方法中調用的發佈函數。如何釋放可可web視圖的內存?

[[NSURLCache sharedURLCache] removeAllCachedResponses];  
[[_webView mainFrame] loadHTMLString:@"" baseURL:nil]; 
[_webView stopLoading:nil]; 
[_webView removeFromSuperview]; 
[_webView setResourceLoadDelegate:nil]; 
[_webView setFrameLoadDelegate:nil]; 
[_webView release]; 
_webView = nil; 

但當做this.It仍有許多內存爲holder.What的我應該做的有沒有發生?

回答

0

事情嘗試:

  • 運行生成並分析和確定每次產生錯誤。
  • 使用Instrument's Leaks tool查找內存泄漏
  • 審覈您的代碼,以確保你是不是保持保留參考的地方。
+0

我已經使用過儀器,沒有發現內存泄漏。我創建了可可webview的類並添加了一個cealrForDealloc函數。內存泄漏看起來像一個輕鬆的改進。 – gohamgx