views:

36

answers:

2

Hey Guys, Now it's time for me to ask a question. Until now I just ignored that Memory Leak. But now it's to find out which object leads to this leak. I have the following code:

 NSDictionary *addressDic = [[NSDictionary alloc] initWithDictionary:[NSPropertyListSerialization propertyListFromData:plistData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&anError]];

At a later Point I also release the addressDic. If I use Instruments to detect Memory Leaks I get one at above posted code. I'm leaking about 16 Bytes and the objecttype is NSCFString. Why?

I hope you can help me.

Sandro

A: 

You need to -release the anError variable if there is an error.

KennyTM
I'll try it now.
Sandro Meier
WoW. That's it. And i thought that's really a braintwister. xD Thank you.
Sandro Meier
A: 

Can you please share the final code? I've tried releasing the error but still get the leak. Many thanks

BX69
Yes sure. Just do the following: if(anError != nil) {[anError release]}. That helped in my case. Because if anError is nil, you don't have to release it. ;-)
Sandro Meier
hmmm... that's what I am doing and still have a leak. Thank you
BX69
Strange. In my case it helped.^^
Sandro Meier