Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

High memory problems caused flash back in iPad #183

Open
archerx3 opened this issue Dec 15, 2016 · 3 comments
Open

High memory problems caused flash back in iPad #183

archerx3 opened this issue Dec 15, 2016 · 3 comments

Comments

@archerx3
Copy link

archerx3 commented Dec 15, 2016

I am using QBImagePicker in my project, I works well and it was very good before.

Preconditions:Just to see the album, not other operations
Recently, the QA test found a high memory problem:

  1. Image count > 1000, running on iPad.
  2. Access camera roll, Fast slide down , caton, than flash back then

I check on code and log, it show me this is not crash and I found received a lot of high memory warning than flash back.

Note:

  1. I had try to set allowsCachingHighQualityImages of PHCachingImageManager to NO, but still received memory warning.
  2. I used demo on iPad, caton phenomenon also occurs.

Now, Can I get some help? Thanks very much.

@archerx3
Copy link
Author

[self.imageManager requestImageForAsset:asset
                                 targetSize:targetSize
                                contentMode:PHImageContentModeAspectFill
                                    options:nil
                              resultHandler:^(UIImage *result, NSDictionary *info) {
                                  
                                  if (cell.tag == indexPath.item)
                                  {
                                      cell.imageView.image = result;
                                  }
                                  
                              }];
[self.imageManager startCachingImagesForAssets:assetsToStartCaching
                                            targetSize:targetSize
                                           contentMode:PHImageContentModeAspectFill
                                               options:nil];

I found two methods above consume more memory using Instruments.

@abdulkerimsahin
Copy link

I fixed this issue with delivery mode option. If you set delivery mode as PHImageRequestOptionsDeliveryModeOpportunistic, memory problem fixes.

Example of code:

PHImageRequestOptions *imageRequestOptions = [PHImageRequestOptions new];
    imageRequestOptions.synchronous = YES;
    imageRequestOptions.networkAccessAllowed = YES;
    imageRequestOptions.deliveryMode = PHImageRequestOptionsDeliveryModeOpportunistic;

[self.imageManager requestImageForAsset:asset
                                 targetSize:targetSize
                                contentMode:PHImageContentModeAspectFill
                                    options: imageRequestOptions
                              resultHandler:^(UIImage *result, NSDictionary *info) {
                                  if (cell.tag == indexPath.item)
                                  {
                                      cell.imageView.image = result;
                                  }
                              }];>

@Jinxiansen
Copy link

@abdulkerimsahin

Cool!
But the author seems to give up maintaining the warehouse.
This is a pity that the issue of accessing iCloud albums has not been resolved:
Set networkAccessAllowed = YES .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants