Memory management / ownership question?

Posted by fuzzygoat on Stack Overflow See other posts from Stack Overflow or by fuzzygoat
Published on 2010-03-15T19:24:02Z Indexed on 2010/03/15 19:29 UTC
Read the original article Hit count: 554

Filed under:
|

Do I have this right ...

// Reactor.h
@property(nonatomic, retain) NSMutableArray *reactorCore;

// Reactor.m
[self setReactorCore:[NSKeyedUnarchiver unarchiveObjectWithFile:[self dataFilePath]]];
...

-(void)dealloc {
    [reactorCore release];
    [super dealloc];
}

I am pretty sure I am doing this right (but just wanted to check). By my way of thinking NSKeyedUnarchiver returns an object it owns, I am then taking ownership via the @property, later I release reactorCore and all is good?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa