简体   繁体   中英

WebViews not releasing memory?

OK, here's my situation :

  • I'm writing a tabbed application (using PSMTabBarControl ).
  • Each tab contains a WebView (actually a MyDocument instance, containing a WebView subclass - but shouldn't make much difference)
  • I'm using ARC.

And here's the issue :

  • When adding new tabs (= documents/webviews), memory in the system monitor goes up fast
  • When removing tabs, the memory is not deallocating

What's going on? Any ideas on how this could be fixed?


If you need to know anything else (eg specific code), please let me know. I'm about to start hitting my head against the wall with this thing...

Not sure how, but these thing worked for me,
While removing WebView ( of-course i had to do it only once when application is getting closed), i was calling [webview close function] refer the documentation,

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM