[NSMutableArray array] returns an autoreleased object.
Everybody's answers are about the property rqst_entries
. Basically, you need a property that has a memory model of retain
. There are instances where you would want to use copy
, but this is usually for immutable types (NSArray, NSString, etc...). NSMutableArray is mutable (you can add entries, remove entries, and modify entries in the array).
You want to define your property like:
@property (nonatomic, retain) NSMutableArray *rqst_entries;
The part that really trips people up is doing an alloc / copy / retain in a property assignment like:
self.rqst_entries = [[NSMutableArray alloc] init];
because this will leak unless followed by a release
[self.rqst_entries release];
The best way to assign in this case is to use a local variable (at least if you need thread safety). like:
NSMutableArray *myArray = [[NSMutableArray alloc] init;
self.rqst_entries = myArray;
[myArray release];
I realize this is a VERY trivial example, but it does illustrate the point.