How do you free memory in xcode 4.2?

In xcode 4.2, I found this very frustrating because you cannot use:

-(void)dealloc {
[label release]; //'release' is unavailable
[super dealloc]; //'dealloc' is forbidden in automatic reference counting
}

Is there any other way because autorelease and other deallocs do not work either.

+5
source share
2 answers

Xcode 4.2 introduces Automatic Link Counting (aka ARC). This is a compiler function that basically inserts save and release calls for you. In ARC, if you have a pointer to an object, you save it. When your pointer goes out of scope or reassigned to indicate another object, the original object is freed. This is really nice.

, , retain, release autorelease, , .

+9

. , .

, ARC. -fno-objc-arc , ARC.

+1

All Articles