开发者

Should I worry about memory management for NIB file resources?

I am trying to improve memory management in an iPhone app. It's helped to set IBOutlets to nil in viewDidUnload, but I'm开发者_如何学编程 wondering if I need to do any memory management around the static UIImageView's in my nib's which aren't hooked up to any IBOutlet. Or does iOS take care of them well by itself?


Generally you do not need to worry about managing any assets that aren't attached to an outlet -- including UIImageView assets -- in NIBs. They will released when the view is released.

If you have any concerns about how memory is being used and released in your app, your best bet is to use instruments to profile memory consumption when the view controller in question loads and unloads. You should see memory increase when the VC loads and drop back to previous levels when the VC is released. If you load/unload the VC many times and you see a steady increase in memory usage, that is when you need to start worrying.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜