IOS memory management - issue with ImageIO_PNG_Data and CoreAnimation growing

I am having problems with an application in which memory continues to grow every time I click on a particular view. The sequential process to restore this increase in memory:

  • Show login controller
  • Click Home View Controller
  • Click "View Settings"
  • Log User Out (button in the settings view controller) - Pops to User Login View controller
  • Input and Start Button Home View Controller

Each time I click on the Home View Controller (although I confirmed that the previous one is freed), the memory jumps up to 6+ mb. I was profiling the application and saw one glaring problem with the VM categories: ImageIO_PNG_Data and VM: CoreAnimation in Allocations.

enter image description here

, Masking View, . , , :

//Draw project image
CGRect newRect = self.frame;
if (useCustomFrame){
    newRect = customFrame;
}

CGImageRef image = CGImageCreateWithImageInRect([self.projectedImage CGImage], newRect);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, 0, rect.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextDrawImage(context, rect, image);

// Release Context
CGImageRelease(image);
+4
1

- :

1. , , .

, 40x40 1X, 80x80 2x . .

  1. , Lazy.

, - IMAGEIO, , NSMainBundle.

imageWithContentsOfFile imageName.

+2

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


All Articles