pa12
pa12

Reputation: 1503

memory leak in nsarray

can any one please tell me whats causing the memory leak. enter image description here

Data_Parser is an NSObject class. This class parses xml file and the values are stored in a NSMutableArray tList.

Thanks

Upvotes: 0

Views: 89

Answers (1)

Ben Zotto
Ben Zotto

Reputation: 71048

You're allocating a mutable array in line 46 and assigning it to ar:

NSMutableArray * ar = [[NSMutableArray alloc] init];

and then in line 48 you're assigning something else to ar. That loses the original array you allocated, which you never use or release. (The code doesn't leak if the for loop doesn't run due to en empty parser list, but the analyzer is showing you where it will.)

Upvotes: 4

Related Questions