I am very confused about when and where to 'release' an object which I created in code block A and will be used later on in code block B.
For instance, in my Controller.m file, I have:
Hope you guys know what I'm saying, I know the rule of thumb is to balance up every alloc with release or autorelease. That said, if I release or autorelease obj in the awakeFromNib, I get runtime errors later when my program invokes manipulateObj.
So please enlighten me in this case, how do you apply the rule of thumb, or is it totally fine just leave it unbalanced?
For instance, in my Controller.m file, I have:
Code:
#import "Controller.h"
.
.
.
- (void) awakeFromNib {
obj = [[Object alloc] init]; //obj is a property defined in Controller.h
}
- (void) manipulateObj {
[obj doSomething];
}
.
.
.
Hope you guys know what I'm saying, I know the rule of thumb is to balance up every alloc with release or autorelease. That said, if I release or autorelease obj in the awakeFromNib, I get runtime errors later when my program invokes manipulateObj.
So please enlighten me in this case, how do you apply the rule of thumb, or is it totally fine just leave it unbalanced?