开发者

Memory Leaks in iPhone

开发者 https://www.devze.com 2023-02-09 05:49 出处:网络
In my application, I am not able to remove the followin开发者_Python百科g memory leaks: [NSCFString appendString]

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消