0

OK、これが私の状況です:

  • タブ付きアプリケーションを作成しています ( PSMTabBarControlを使用)。
  • 各タブにはWebView(実際にMyDocumentはサブクラスを含むインスタンスですが、WebView大きな違いはありません)
  • ARCを使用しています。

そしてここに問題があります:

  • 新しいタブ (= ドキュメント/Web ビュー) を追加すると、システム モニターのメモリが急速に増加します。
  • タブを削除すると、メモリの割り当てが解除されない

どうしたの?これをどのように修正できるかについてのアイデアはありますか?


他に何か (特定のコードなど) を知る必要がある場合は、お知らせください。これで壁に頭ぶつけそう…

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 に答える