Search code examples
objective-cdealloc

Can i use the dealloc() method in ARC in objective c?


I am a newbie in objective-c

I have a lot of memory issues, and a lot of alloc variables

-what to do?


Solution

  • First of all, in Objective-C in contrast to functions methods are nor called (but invoked via a dispatch) neither using () . The typical spelling for a method is -dealloc. Sending a message to execute it, is done with [] as in [self dealloc].

    No, you cannot do this. Your code will break.

    You never send a dealloc message directly. (Apple Doc)

    If you have memory leaks with ARC, the reason are retain cycles. Read something about it. Most retain cycles are easy to detect. However, you can use the Instruments (Allocations) to detect them at runtime.