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. 
*/