Is UIImage imageNamed still causing memory issues on iOS4 for large images?

I found a couple of memory management articles mentioning UIImage imageNamed , which causes problems when you have many large images in memory.

http://akosma.com/2009/01/28/10-iphone-memory-management-tips/ http://www.alexcurylo.com/blog/2009/01/13/imagenamed-is-evil/

Both of them were written for OS version = 3.0.

Does anyone know if this is still a problem in iOS 4?

+2
source share
3 answers

No longer a problem, see here and maybe here .

+3
source

If you look at this link: By expanding UIImage imageNamed: FUD , you will see that there are two problems with large images and imageNamed:

  • Prior to iOS 3.0, there was an error in the imageNamed caching procedures: so that it did not release its cache, even when it received a warning about mem. This was a pretty serious problem, and for me it was the source of a large number of memory failures, since you could not return the memory after using imageNamed: load it. This is no longer a problem, as it seems to be fixed in version 3.0.
  • imageNamed: stores uncompressed image data in its cache. For really large (on the screen size - width x height) images, this data can be really large. width * height * 4 is what I usually saw in its uncompressed size. This can still be a problem for you if you use fairly large images - and especially this should be avoided if you don't need to redraw them often.

So, to repeat: 1 is no longer a problem, 2 maybe.

+2
source

he does. Combined with the UIPageViewController, this is certainly the case. When trying to create an application for children that displays animal animations and KeyFrame animations, all individual animal details are in the UIViewController. All views are displayed in the UIPageViewController (transition: scroll). I did not know about imageNamed error and for almost a month, I thought that this was a problem caused by UIPageViewController. ARC never released memory. ASA I switched to imageWithContentsOfFile instead of imageNamed, all problems are resolved. UIPageViewController was innocent of reality. Now it works smoothly. Unreleased memory issue.

0
source

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


All Articles