I'm building a game that uses some images, and I load them in UIImageViews. By making some tests, I realized that the memory increases when I load the images, but do not decrease when I remove the UIImageView from superview.
Example:
- initial memory: 50mb
- then I load some images in many UIImageViews (that are inside a UIView)
- the memory goes to about 70mb
- remove all UIImageViews from superview, and then remove the UIView
- the memory keeps 70mb
It seems like the loaded PNG (in this case, I use assets to storage all of them) keeps in memory/cached, and only "decache" when the app closes.
How can I resolve this? When the app goes to about 70-80mb, the app starts to become slower, and it is very frustrating.