When has happen to the release method? I always release a memory allocation when I am done with it and now it seems that the method has been deprecated. Or maybe it does not work for some objects?
Anyway, this is what I did:
Customer *aCustomer = [[Customer alloc] init];
...
[aCustomer release];
and I get an error there... Anyone care to explain why I get an error now that I release my memory? The error message is:
'release' in unavailable: not available in automatic reference
counting mode ARC forbids explicit message send of 'release'
If you have enabled the 'ARC', then you don't need to release
an object. That will be handled by the compiler. retain
, release
and autorelease
are all handled by the compiler.
Edit:
You could know more about that from here
Also there already a SO thread exists. Please go thru that.
To manage memory by yourself go to "build settings" and set the flag "Objective-C automatic reference counting" to "No" (it's under "Apple LLVM compiler")
Automatic Reference Counting (ARC) for Objective-C makes memory
management the job of the compiler. By enabling ARC with the new Apple
LLVM compiler, you will never need to type retain or release again,
dramatically simplifying the development process, while reducing
crashes and memory leaks. The compiler has a complete understanding of
your objects, and releases each object the instant it is no longer
used, so apps run as fast as ever, with predictable, smooth
performance.
- iOS 5 for Developers
Consider using ARC (Automatic Retain Counting) for your project. There is a refactoring that will convert a current project.