使用 sbjson 框架重复使用时出现数千次内存泄漏
我正在为我的应用程序使用 JSON 框架 (SBJson)。
使用此代码在控制器中第一次解析该值
NSDictionary *results = [responseString JSONValue] ;
没有问题。当我再次调用同一控制器时,它显示数千个内存泄漏。
我浏览了很多论坛但没有成功。有人可以告诉我我做错了什么吗?
完整代码:
NSString *response = [[NSString alloc] initWithData:webData encoding:NSUTF8StringEncoding];
//NSDictionary *results =[[response JSONValue] retain] ;
if (results) {
[results release];
results=nil;
}
results =[[response JSONValue] retain] ;
[response release];
提前致谢
问候, Sathish
I am using JSON framework (SBJson) for my applicaition.
parsing the value by
NSDictionary *results = [responseString JSONValue] ;
For parsing first time in controller with this code has no problem. when i call again for same controller it shows thousands of memory leaks.
I went through many forums but in vain. can anybody please tell me what i went wrong?
Full Code:
NSString *response = [[NSString alloc] initWithData:webData encoding:NSUTF8StringEncoding];
//NSDictionary *results =[[response JSONValue] retain] ;
if (results) {
[results release];
results=nil;
}
results =[[response JSONValue] retain] ;
[response release];
Thanks in advance
Regards,
Sathish
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在第二次解析之前释放该对象。
Try releasing the object before parsing it a second time.