Below are three fragments of code, the first two are interfaces for two objects along with a couple of @property commands. Please note that this is just me learning, its not part of an application just a small test program.
After adding (retain) to the 2nd @property I noticed that my machine object was leaking when my program exited, what I did to fix this was add a release in the Artist objects dealloc, does this sound right?
@interface Machine : NSObject
{
NSString *name;
NSString *type;
NSString *os;
}
@interface Artist : NSObject
{
NSString *name;
Machine *system;
}
@property(copy) NSString *name;
@property(retain) Machine *system;
@end
// DEALLOC IN @implementation Artist
-(void)dealloc {
NSLog(@"_deal: %@", self);
[system release];
[super dealloc];
}
gary