gpt4 book ai didi

iphone - NSMutableArray 的大小(内存)是多少?

转载 作者:搜寻专家 更新时间:2023-10-30 19:52:33 26 4
gpt4 key购买 nike

我正在解析 json 数据,并将它们存储到 NSMutableArray 中。对于每个数据,参数格式如下,

{
"id":"6",
"username":"biju",
"password":"biju123",
"usertype":"2",
"first_name":"biju",
"last_name":null,
"email":"b@b.com",
"blocked":"N",
"created":"2012-11-02 16:03:19",
"image":"http:\/\/192.168.1.254\/eatthos\/assets\/upload\/users\/1351852399_thumb.jpg","thumb_image":"1351852399_thumb.jpg",
"menu_image":"0",
"thumb_menu_image":"0",
"city":"njdfh",
"favorite_food":"kafh",
"favorite_restaurant":"kafdhj",
"phone_number":"0",
"description":"0",
"token":"Dwx0DG",
"fb_unique_id":null,
"account_type":"normal",
"twitter_id":null,
"followers":"5",
"follow":"N"
}

我正在解析大约 100K 的数据,该数组的大小(内存)是多少?如果我将它用于 iphone 应用程序,是否会出现内存问题?

最佳答案

您可以尝试使用以下代码找出数组的大小:

size_t total;
id obj;
for (obj in array)
{
total += class_getInstanceSize([obj class]);
}

NSLog(@"Array size : %ld",total); //This will return you size in bytes

你需要做的:#import <objc/runtime.h>

关于iphone - NSMutableArray 的大小(内存)是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13263526/

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