So, in my app I have a bunch of view controllers that use UICollectionView
as their main structure. These contain cells composed of an image and some overlay text and there are a potentially large number of these cells that will be created throughout the course of navigating the app (well into the hundreds and possibly 1000+. It's a huge catalog of content). I've found the enabling rasterization:
cell.layer.shouldRasterize = true
cell.layer.rasterizationScale = UIScreen.mainScreen().scale
drastically speeds up performance, making the framerate go from ~31fps to ~58fps, but, as expected, the memory for the app steadily increases.
So my question is when are these cached rasterized images removed? Is it only when the app is stopped? Or is it when the views containing them are deinit? Is there a way to manually force them to be removed if it's the former?
The cached layers are removed if unused for 100ms.
Here are important notes from WWDC 2014