I have stored no of images(For ex : Consider 60+) in document directory. I have to show all those images in table-view. these images are big so i am resizing the images as per this link http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/
Here what i make code in cellforrow is :
@autoreleasepool {
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
dispatch_async(queue, ^{
NSString *folderPath = [self getEduCurrentDiractoryPath];
NSString *filePath = [folderPath stringByAppendingPathComponent:[message.internalUrl.absoluteString lastPathComponent]];
NSLog(@"currentDirectoryPath %@",filePath);
dispatch_sync(dispatch_get_main_queue(), ^{
cell.message.thumbnail = [[UIImage imageWithContentsOfFile:filePath] resizedImage:CGSizeMake(210, 170) interpolationQuality:kCGInterpolationLow];
});
});
}
Now when i check with the INSTRUMENTS to see ALLOCATIONS and tried to find the memory warning cause it shows below result :
So here you can see resizeimage:interpolationQuality method shows 168MB allocation , where My project ARC is on and i have put that code in @autoreleasepool too.. but it is not releasing the allocated memory...
Can any one help me how to rezise the image properly wiout getting memory warning or some can point out where i am making mistake.. Any help will be appreciated..!!! Thanks..
Try this. Here imgProf is my image name.
and this is function created by me to resize image.