0

OK,這裏是我的情況:WebViews不釋放內存?

  • 我正在寫(使用PSMTabBarControl)選項卡式應用程序。
  • 每個標籤包含一個WebView(實際上是一個MyDocument實例,包含WebView子類 - 但應該沒有太大的差別)
  • 我使用ARC。

而這裏的問題:

  • 當系統監控器添加新的選項卡(=文件/網頁視圖),內存上漲快
  • 去除彈片,內存取消分配

發生了什麼事?任何想法如何解決這個問題?


如果您需要了解其他任何信息(例如特定代碼),請告訴我。我即將開始打我的頭這個東西牆...

+0

還對一些博客,我都看到了,如果你在活動監視器看到內存,有時可能不準確記憶由應用程序使用,儘管ARC不是,但它不會釋放內存的某些部分,除非系統請求... – Amitg2k12 2013-02-18 08:49:05

回答

3

不知道如何,但這些東西爲我工作,
當拆下的WebView(中 - 當然,我不得不這樣做只有一次當應用程序被越來越關閉),我打電話[網頁流量關閉功能]參閱文件,

/*! 
    @method close 
    @abstract Closes the receiver, unloading its web page and canceling any pending loads. 
    Once the receiver has closed, it will no longer respond to requests or fire delegate methods. 
    (However, the -close method itself may fire delegate methods.) 
    @discussion A garbage collected application is required to call close when the receiver is no longer needed. 
    The close method will be called automatically when the window or hostWindow closes and shouldCloseWithWindow returns YES. 
    A non-garbage collected application can still call close, providing a convenient way to prevent receiver 
    from doing any more loading and firing any future delegate methods. 
*/ 
- (void)close; 

/*! 
    @method setShouldCloseWithWindow: 
    @abstract Set whether the receiver closes when either it's window or hostWindow closes. 
    @param close YES if the receiver should close when either it's window or hostWindow closes, otherwise NO. 
*/