2

このコードで UIImage を追加するだけで、メモリが約 50MB 増加します。画像自体のサイズは {2448, 3264} ピクセルです。

ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset)
{
    ALAssetRepresentation *rep = [myasset defaultRepresentation];
    CGImageRef iref = [rep fullResolutionImage];
    if (iref)
    {
        UIImage *selectedBackground = [UIImage imageWithCGImage:iref scale:[rep scale] orientation:(UIImageOrientation)[rep orientation]];
        CGImageRelease(iref);
        [self setBackgroundWithImage:selectedBackground orColor:nil];

    }
};
ALAssetsLibraryAccessFailureBlock failureblock  = ^(NSError *myerror)
{
    NSLog(@"Can't get image - %@",[myerror localizedDescription]);
};

ALAssetsLibrary* assetslibrary = [[ALAssetsLibrary alloc] init];
[assetslibrary assetForURL:photoURL resultBlock:resultblock failureBlock:failureblock];

なぜメモリが大幅にジャンプするのですか?

4

0 に答える 0