iOS: How to remove object from memory with ARC enabled?

后端 未结 4 2035
一生所求
一生所求 2020-12-16 02:14

I am developing an iOS app with the iOS 5 SDK, Automatic Reference Counting is enabled. But I have a specific object that is being created in large numbers and must be relea

4条回答
  •  离开以前
    2020-12-16 03:05

    Just surround the section of code that is going to be called 200 times with an @autoreleasepool { ... } statement. This will cause the memory to be deallocated immediately as opposed to waiting for the control to go all the way back up the event chain to the top level autorelease pool.

提交回复
热议问题