Multiple contexts in the main thread: why and when use them?

妖精的绣舞 提交于 2019-12-02 04:12:34

flexaddicted,

Main thread contexts are most useful for scratchpad work and managing your working set.

Scratchpad work is using the MOC to process data you don't intend to -save:. Or to set up things for the undo manager. I find this of less value than you might think.

If your UI is going to display a bunch of objects that are not used in the rest of your UI, then you can manage memory by using the new MOC and then disposing of it when you dismiss the view. This allows all of those items that have no utility to the rest of your app to be disposed. While this can be useful to manage memory, it isn't a substitute for responding to the memory warnings in iOS to trim your tree.

Andrew

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!