massive memory leak in ios UIWebView

The way I got rid of my UIWebView’s memory leakage is by setting its HTML to the empty string. One place to do this is when the view controller containing the web view disappears:

- (void) viewWillDisappear:(BOOL)animated {
    if (self.isMovingFromParentViewController) {
        [self.wv loadHTMLString: @"" baseURL: nil];
    }
}

Leave a Comment