A newly alloc] init]ed NSURLConnection has retainCount = 3 ??
A newly alloc] init]ed NSURLConnection has retainCount = 3 ??
- Subject: A newly alloc] init]ed NSURLConnection has retainCount = 3 ??
- From: Jerry Krinock <email@hidden>
- Date: Mon, 25 Jul 2005 15:04:26 -0700
When I -alloc] init] an NSURLConnection, the result has a retain count of 3
instead of 1. This makes it makes it really confusing later when I want to
get rid of it. Please someone explain this to me before I do too much
reverse-engineering! Log output from Demo program:
A new NSString has retainCount = 1
A new NSURLConnection has retainCount = 3
which was made by executing the following tool:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString* string = [[NSString alloc]
initWithString:@"http://www.apple.com"] ;
NSLog(@"A new NSString has retainCount = %i", [string retainCount]) ;
NSURL *url = [NSURL URLWithString:string];
NSURLRequest* theRequest=[NSURLRequest requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:60.0];
NSObject* aDelegate = [[NSObject alloc] init] ;
NSURLConnection* connection = [[NSURLConnection alloc]
initWithRequest:theRequest delegate:aDelegate];
NSLog(@"A new NSURLConnection has retainCount = %i", [connection
retainCount]) ;
[pool release];
return 0;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden