问题:最近做游戏有个很奇怪的问题,我UIViewController已经释放掉了, 但是我的内存还是比没打开UIViewController时多70M。所以需要找到问题 解决掉。
未打开Controller时
打开controller后
关闭controller后
解决办法: 最大的内存占用是图片的占用,需要自己管理图片内存。imageWithContentsOfFile: 代替imageNamed:
It depends on how you are loading the image. If you are using
imageNamed:onUIImagethe image you load will actually get cached. This is true also if the image is loaded via XIB or storyboard. Assuming there isn't some other retain cycle issue, the cache will get purged when a low memory notification is posted.If you're wanting to be more proactive than that, then do not load the image via XIB, storyboard, or the
imageNamed:API onUIImage. Instead, use theimageWithContentsOfFile:API.
stackvoerflow stackoverflow.com/questions/2…
UIImage 官方文档 developer.apple.com/documentati…