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

后端 未结 4 2039
一生所求
一生所求 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 02:57

    With ARC you cannot call dealloc, release, or retain, although you can still retain and release CoreFoundation objects (NB: you can implement dealloc methods for your own custom subclasses, but you can't call super dealloc). So the simple answer is 'no', you unfortunately cannot manually release an object when using ARC.

    I'd double check you're sure they're not being released, because in theory if you no longer reference an object it should be released. What do you do with these objects once you create them? You simply create them then immediately destroy them?

    Perhaps you could post the code you're using / the property declarations - are these weak or strong referenced objects?

提交回复
热议问题