I have a property declared like this:
@property (nonatomic, retain) NSMutableArray *pricingLevels;
And I assign it like this:
self.pricingLevels = [[[NSMutableArray alloc] init];
in my dealloc I have this:
self.pricinglevels=nil;
When I analyze my code with xCode it says I have a memory leak here:
self.pricingLevels = [[[NSMutableArray alloc] init];
Should I be using an autolrelease on this because the self.pricinglevels holds a reference to the array also?
self.pricingLevelsis a property declared asretainedwhich means every time you set it thru property assignment (the dot-syntax OR the method), the object automatically retains the object for you.The above code will do the same and automatically retain the array passed. This is what happens under the hood (or something similar). This method gets called:
You see? Automatically retained, while the previous value automatically gets released.
EDIT to answer your last question: Yes you should call
autorelease