views:

46

answers:

0

I have an app that parses an XML doc & pulls out the info it needs. There are often a few matching items so the code iterates a few times. Instruments' Leaks tool keeps saying there is a leak on this line,

self.currentDiscountedPrice = [parsedCharacters substringToIndex:(fullStopRange.location + 3)];

currentDiscountedPrice is a var declared with the retain property so self.currentDiscountedPrice releases the previous value & retains the current value. To my knowledge substringToIndex does not retain the returned value so there is no double retain & I release the old value so why does Leaks say there is a leak here?

(In case it's relevant, I add all the values that are found for an item into a temporary dictionary using

NSDictionary *tempRecord = [NSDictionary dictionaryWithObjectsAndKeys:

and then add that dictionary into an array using

[returnedArray addObject:tempRecord];

until all items have a dictionary object in the array i.e. save all details to vars as found, then create dict for item & save in array)