Re: knowing when WebView is done
Re: knowing when WebView is done
- Subject: Re: knowing when WebView is done
- From: "Adam R. Maxwell" <email@hidden>
- Date: Fri, 06 Jun 2008 22:32:11 -0700
On Jun 6, 2008, at 10:06 PM, Timothy Ritchey wrote:
Out of curiosity, did you ever check the retain counts on your
webview objects?
Never. Since the frameworks retain/(auto)release stuff all the time
behind your back, logging -retainCount is worse than useless, in my
opinion.
If something's leaking, I use Instruments or OmniObjectMeter to see
what's holding on to it. In this case, I keep a small pool of
WebViews around and reuse them, so I've never bothered to check.
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame
*)frame
{
if(frame == [sender mainFrame]) {
... grab thumbnail image ...
[webView stopLoading:nil];
[webView setFrameLoadDelegate:nil];
NSLog(@"retain count (before): %d", CFGetRetainCount(webView));
[webView release];
NSLog(@"retain count (after): %d", CFGetRetainCount(webView));
}
}
and the log file shows a retain count of 2 before, and 1 after.
Something else is holding onto my webView, or it has been so long
since I've programmed cocoa in anger that I've lost all sense of
alloc/init behavior.
From a quick check with Instruments, it looks like internal WebKit
stuff is retaining the view for callbacks even after it's done
loading, then releasing it on a later pass through the runloop. I
wouldn't worry about it unless you're actually leaking the object.
--
Adam
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden