Objective-C/iPhone Memory Management Static Variables

前端 未结 3 1422
醉话见心
醉话见心 2020-12-05 12:02

I have a static method that creates an instance of the class and puts it in the static variable. I am wondering what the proper way of memory management is in this situation

3条回答
  •  难免孤独
    2020-12-05 12:29

    You can either not release them, which is fine since the app is shutting down anyway. Cocoa on the iPhone already does this, it doesn't completely delete everything, it just lets the app get blown away.

    Or you can delete it from appWillTerminate or some other shutdown function.

提交回复
热议问题