iOS: Memory Leak -



iOS: Memory Leak -

in utilities class, have next method:

+ (division *) getnationaldivision { partition *defaultdivision = [[[division alloc] init] autorelease]; defaultdivision.id = 0; defaultdivision.name = @"national"; homecoming defaultdivision; }

i have partition allocted in app delegate store partition throughout app, in 1 of view controllers have:

appdel.currentdivision = [[utilities getnationaldivision] retain];

in app delegate .h have:

@property (nonatomic, retain) partition *currentdivision;

in app delegate .m have:

currentdivision = [[division alloc] init];

when analyze, potential leak of object points above line. ideas? if dont retain national division, doesnt work. also, note, works fine. want create sure not leaking something.

check how declare property currentdivision in app delegate. if assign (which suppose, since retaining before assigning through property) original value assigned it:

currentdivision = [[division alloc] init];

will not released when execute:

appdel.currentdivision = [[utilities getnationaldivision] retain];

hence, object created in app delegate leak. release manually , check whether analyzer keeps complaining:

[app.currentdivision release];

this makes sense in case property declared assign.

in case declared retain, fault on line:

appdel.currentdivision = [[utilities getnationaldivision] retain];

where should not retain manually.

ios memory memory-leaks

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -