Tips for Reducing Memory Usage of the Main Animation

So the situation:

I have CALayer, the size of my screen, and I set the content property to 2 MB JPEG, which is approximately 3500 x 2000 pixels in size with a resolution of 240 pixels.

I expect a little overhead in CALayer, but my sample application (which does only what is stated above) shows the use of about 33Mb RSIZE, 22Mb RPVT and 30Mb RSHRD. I noticed that these numbers are much better when running the application in 64-bit mode than in 32-bit mode.

I'm doing everything I can think of in the real application that this example came from, including re-fetching my CGImageRefs just for the size of the layer, but it seems to me an extraneous - shouldn't it be easier?

Does anyone come across good methods to reduce the memory footprint of CALayers and CGImageRefs?

+3
source share
1 answer

Firstly, you will encounter problems with image size in regular CALayer, because you can click the texture size limit of 2048 x 2048 (depending on your video card). Applications like this are for CATiledLayer. Bill Dudney has some code examples on his blog (large PDF), as well as the code that accompanies his book .

, , , CGImage. CATiledLayer, . CGImageRef, CAlayer? .

+4

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


All Articles