objective c - iphone copyWithZone memory leak - need help -


I have a hard time finding out what I am doing, so I hope someone correct me Can indicate in direction I am working on an app where there is an array of objects, each of these objects can have an array of objects and therefore (for the purpose of navigation) there is an indicator on its master object when I am one of these items I am facing a memory leak, I am trying to make a copy.

  @interface listItem: NSObject & lt; NSCopying & gt; {ListItem * MasterItem; NSString * strText; NSMutableArray * listItems; Bool bool don; NSDate * itemDate; } @ Property (non-nominal, retention) list * System * MasterItem; @property (non-constructive, retaining) NSString * strText; @protecti (nontomic, retten) nsmutbailarra * listimetermine; @property (nontomic, raten) NSDT * motherdate; @profile BOOL bool don; @end @implementation ListItem @ synthesize strText, listItems, boolDone, MasterItem, itemDate; - (id) init {if (self = [super init]) {self.strteext = noil; Self.listItems = Zero; Self.itemDate = Zero; Self.boolDone = FALSE; Self. Mastitis = zero; } Healthy return; } - (Id) Copywidth Zone: (NSZEN *) Area {ListItem * another = [[[Self class] allocWithZone: zone] init]; second. Master item = [MasterItem copy with zone: area]; Other.listItems = [listItems copyWithZone: area]; Another.stroteext = [Strip Text Copith Lake: Zone]; Other.itemDate = [with item copy zone: field]; Other.boolDone = boolDone; Second return; } - (zero) Delok {if (MadDate! = Zero) [Item release]; If (MasterItim! = Zero) [Master Itam Release]; If (Stratxt! = Zero) [Stretched Release]; If (listItems! = Zero) [list release]; [Super DeLoc]; } @end   

When I'm calling it, then the memory leak:

  list item * itemsmasterstores = [madmaster copy]; [Madstreet release];    

line

  another.masterItem = [MasterItim Copy with zone: zone];   

should be

  another.MasterItem = [[MasterItem copy with zone: zone] autorequez];   

And for every line of property setting.

In addition, you forgot to release the NSDAT property.

Tip: You do not need to check zero because it's already taken care of by Objective Runtime

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -