• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Incrementing retain count using DO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Prev by Date: Re: Switching off antialiasing...
  • Next by Date: Re: Applescript over SOAP/XML
  • Previous by thread: Re: Switching off antialiasing...
  • Next by thread: [Help] How to get instance of instantiated Controller in nib from Controller in another nib? (Java)
  • Index(es):
    • Date
    • Thread