【发布时间】:2012-11-25 18:32:41
【问题描述】:
在我的应用程序中使用 Instruments ->Leaks 我发现最大的内存泄漏在 SBJson Parser 实现文件中:
@implementation SBJsonStreamWriterAccumulator
@synthesize data;
- (id)init {
self = [super init];
if (self) {
data = [[NSMutableData alloc] initWithCapacity:8096u]; //HERE IS 100% LEAK
}
return self;
}
#pragma mark SBJsonStreamWriterDelegate
- (void)writer:(SBJsonStreamWriter *)writer appendBytes:(const void *)bytes length: (NSUInteger)length {
[data appendBytes:bytes length:length];
}
@end
1.如何正确解决这个问题而不使解析器崩溃?
2.为什么在使用 SBJson 时会有这么多内存泄漏问题?
【问题讨论】:
标签: objective-c ios json memory-leaks sbjson