Why Im having a memory leak here:
.h:
@property (nonatomic, retain) NSDictionary *info;
and then in my .m:
@synthesize info = _info;
and Im having one leak here:
- (id)initWithData:(NSDictionary *)data
{
self = [super init];
if (self) {
self.info = [[NSDictionary alloc] initWithDictionary:data];
}
return self;
}
And another leak here:
-(void)dealloc {
[self.info release];
[super dealloc];
}
Your leak stems from your property declaration and the way you assign it, when you declare a property as “retain” using the setter will retain the var for you, so doing
Retains the var, and since alloc also retain the var you get a +2 retain count, you should either autorelease the object or assign it like
also when you release a property do so by setting it to nil