Memory Increase while Retriving data from database for loading image

坚强是说给别人听的谎言 提交于 2019-12-25 08:28:22

问题


I am working on application in which I store data of image into database like

NSString *query = [NSString stringWithFormat:@"INSERT INTO Friends_user (f_id,f_name,f_image,f_mobile) VALUES('%ld','%@','%@','%@')",(long)id_, self.txt_name.text,[UIImagePNGRepresentation(self.img_userprofile.image) base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength], self.txt_mobile_no.text ];

It stores Successfully but when I retrieve that data to display image, Memory Increases with every image. Here is my code to retrieve data

NSData *data = [[NSData alloc]initWithBase64EncodedString:[[arr_friendList objectAtIndex:indexPath.row] objectAtIndex:2] options:NSDataBase64DecodingIgnoreUnknownCharacters];
    img_friend_profile.image= [UIImage imageWithData:data];

[theAppDelegate.dbManager executeQuery:query];

My Datatype in database is BLOB.
Memory increases Upto 10-20 MB per image. Please Help me with it

Thank you

来源:https://stackoverflow.com/questions/39995156/memory-increase-while-retriving-data-from-database-for-loading-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!