0

好的,这是我的情况:

  • 我正在编写一个选项卡式应用程序(使用PSMTabBarControl)。
  • 每个选项卡都包含一个WebView(实际上是一个MyDocument实例,包含一个WebView子类 - 但应该没有太大区别)
  • 我正在使用ARC。

是问题所在:

  • 添加新选项卡(= 文档/网络视图)时,系统监视器中的内存快速增加
  • 删除选项卡时,内存不会释放

这是怎么回事?关于如何解决这个问题的任何想法?


如果您需要了解其他任何信息(例如特定代码),请告诉我。我正要开始用这个东西把我的头撞到墙上......

4

1 回答 1

3

不知道如何,但是这些东西对我有用,
在删除 WebView 时(当然,当应用程序关闭时我只需要这样做一次),我正在调用 [webview close function] 请参阅文档,

/*!
    @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.
*/
于 2013-02-18T08:47:29.313 回答