gpt4 book ai didi

iphone - SBJSON 解析器内存不足警告

转载 作者:行者123 更新时间:2023-11-29 04:19:43 24 4
gpt4 key购买 nike

enter image description here enter image description here我正在研究 JSON 数据解析,需要大量图像下载和数据解析。我有以下解析代码

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{

NSString *responseString = [[NSString alloc] initWithData:webdata encoding:NSASCIIStringEncoding];
[webdata release];
[connection release];
NSDictionary *values = [(NSDictionary*)[responseString JSONValue] objectForKey:@"UserId"];
NSDictionary *Active = [(NSDictionary*)[responseString JSONValue] objectForKey:@"Active"];
[responseString release];
NSString *UserID=[NSString stringWithFormat:@"%@",values];
NSString *Status=[NSString stringWithFormat:@"%@",Active];
[WSDelegate WServiceResponseMsg:@"WS_Authenticate_User" withResponse:UserID forParam:Status];
}

我有许多带有上述代码的类用于解析,但由于 SBJSON 解析器,应用程序在一段时间后崩溃。在仪器中,它会因内存不足警告而导致应用程序崩溃。 enter image description here

最佳答案

大多数开发人员在使用 SBJSONParser 时认为它存在内存泄漏,这是一个非常错误的假设。 SBJSONParser 没有任何泄漏,也不会在您的代码中引入泄漏。INSTRUMENTS 确实告诉您泄漏是由于 SBJSONParser 造成的,但它表示其他原因。泄漏是由于您实现 SBJSONParser API 的方式造成的。您的代码中一定做错了什么。

检查仪器的泄漏情况。打开“扩展详细信息”工具栏并查看存在泄漏的代码行。仪器会告诉您最近的泄漏位置。

关于iphone - SBJSON 解析器内存不足警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13122305/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com