Re: Strange Retain Count?
Re: Strange Retain Count?
- Subject: Re: Strange Retain Count?
- From: "Brian O'Brien" <email@hidden>
- Date: Mon, 21 Nov 2005 21:52:45 -0700
On 21-Nov-05, at 9:26 PM, Andrei Tchijov wrote:
[ t startPortServer: self ]
looks like possible culprit. is it possible that its retain its
parameter?
It sure does....
The thread wants to have a copy of the owner of the thread so it
can call the thread to say when it is completed...
That thread has its own autorelease pool...
and just before it finishes it releases its pool.
So hopefully when the thread finishes the retain count on test will
be one.
On Nov 21, 2005, at 11:23 PM, Brian O'Brien wrote:
On 21-Nov-05, at 9:17 PM, Ryan Britton wrote:
It could be correct. It depends partially on what all happens in
the init method. It's very possible something else retains it
from something called in there. You generally can't assume that
the retain count will be a certain value because you have no
control over what happens behind the scenes.
This is the init for the test class (Which I wrote)
-(id) init
{
self = [super init];
ar = [NSMutableArray arrayWithCapacity:256];
t = [[[MRCDicomSCPThread alloc] init] autorelease];
NSMutableArray *list = [NSMutableArray arrayWithCapacity:10];
[list addObject:[NSString stringWithString:@"SEAIMS1"]];
[list addObject:[NSString stringWithString:@"OSIRIX"]];
[list addObject:[NSString stringWithString:@"BRIANSLAPTOP"]];
[t setAET:[NSString stringWithString:@"STORESCP"]
andAETitleList:list onPort:104];
[t startPortServer:self];
return self;
}
On Nov 21, 2005, at 8:10 PM, Brian O'Brien wrote:
testClass *test = [[[testClass alloc] init] autorelease];
NSLog(@"test retain count = %d", [test retainCount]);
Prints out:
2005-11-21 21:05:54.165 testDNewServer[2090] test retain count = 2
Is 2 right????
I thought it should be one..
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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