Memory Leaks in iPhone
In my application, I am not able to remove the followin开发者_Python百科g memory leaks:
[NSCFString appendString]
[NSCFString copyWithZone];
[NSDecimalNumberPlaceHolder initWithDecimal]
[SBJsonParser scanRestOfArray]
[SBJsonParser scanRestOfDictionary]
[NSPlaceholderMutableString initWithCapacity]
How to remove these leaks?
These are not leaks caused by system libraries. Leaks tool just points you where is the possible cause of the leak. For example, if you write like this:
NSString* str = [[NSString alloc] initWithCString: "some_str"];
In this example str is allocated but never released. Leaks tool would show you that there is a leak in [NSPlaceholderString initWithCString:]
but in fact there is leak because you didn't send release
message to str.
So a little tip: always search problem in your own code and not in the frameworks you're using.
精彩评论