- Joined
- Jan 6, 2011
- Messages
- 2
- Reaction score
- 0
- Points
- 1
hi,
I am learning obj-c. I know that dealloc automatically start to operate when retain count reaches 0. Im my code [obiektos RetainCount] return 1, but dealloc is called (personally I've thought that [obiektos RetainCount] will return 0 and that's why dealloc is called).
why there is 1, not 0 at output?
output:
2011-04-08 21:19:27.853 Metoda prostokta[207290f] zadzialal dealloc
2011-04-08 21:19:27.869 Metoda prostokta[207290f] 1
here is dealloc:
I am learning obj-c. I know that dealloc automatically start to operate when retain count reaches 0. Im my code [obiektos RetainCount] return 1, but dealloc is called (personally I've thought that [obiektos RetainCount] will return 0 and that's why dealloc is called).
why there is 1, not 0 at output?
output:
2011-04-08 21:19:27.853 Metoda prostokta[207290f] zadzialal dealloc
2011-04-08 21:19:27.869 Metoda prostokta[207290f] 1
Code:
#import "nowycos.h"
//#import "ojej.h"
int main (int argc, const char * argv[]) {
nowycos*obiektos;
nowycos*obiektos1;
obiektos=[nowycos new];
[obiektos release];
NSLog(@"%d", [obiektos retainCount]);
return 0;
}
here is dealloc:
Code:
-(void) dealloc
{
NSLog(@"zadzialal dealloc");
[super dealloc];
}