Incrementing retain count using DO
Incrementing retain count using DO
- Subject: Incrementing retain count using DO
- From: "Mike Vannorsdel" <email@hidden>
- Date: Thu, 19 Jul 2001 04:46:59 -0600
I'm using DO for thread communication. Here sort of what I'm doing:
//all the same instance
- (IBOutlet)doCalc:(id)sender
{
[NSThread detachNewThreadSelector:@selector(bigMethod:)
toTarget:self withObject:portsArray];
//portsArray in an array of NSPorts from an NSConnection
initialized at instance init
}
- (void) bigMethod:(NSArray*)inPorts
{
NSAutoreleasePool * thepool=[[NSAutoreleasePool alloc] init];
NSConnection * theConnection=[NSConnection
connectionWithReceivePort:[inPorts objectAtIndex:0] sendPort:[inPorts
objectAtIndex:1]];
id Proxy=[[theConnection rootProxy] retain];
[Proxy setProtocolForProxy:@protocol(myProto)];
//do calcs
[Proxy reportProgress];
//iterate or finish calcs
[Proxy release];
[thepool release];
}
- (oneway void)reportProgress
{
//report progress
}
The problem is that every time I call doCalc:, my instance's retain
count is incremented by one. So after a few runs, the retain count is 4
rather than 1 as it should be. Is there something wrong with my use or
something I'm missing? Thanks.