UIImage memory issues due to caching

I googled for a memory issue related to UIImage, and came across many topics that talk about the problem but have no real help or solution.

I know when we use the -imageNamed:object is cached, so it’s better to use initWithData:. When we use drawRect:and UIGraphicsGetImageFromCurrentImageContext(), does the image go cache?

Also in the following code:

CGImageRef tmp = CGImageCreateWithImageInRect(imageToCrop.CGImage, clippedRect);    //pull the image from our cropped context    UIImage *cropped = [UIImage imageWithCGImage:tmp];//UIGraphicsGetImageFromCurrentImageContext();  
CGImageRelease(tmp);

Does caching happen even though there is no link in the documentation? How do we free the memory consumed by the cache?

+3
source share
1 answer

, , , , CGImage UIImage . CGImage.

, UIImage, . , , , , , -initWithData:

0

Source: https://habr.com/ru/post/1719524/


All Articles