Interesting. And I still wonder why ARC seems to need any library support.
In my understanding (which is certainly wrong) ARC is automatic reference counting.
Done by a static analysis of the source code. Done during compile time and not
during run time where the libs/frameworks would play a role. This is the reason why
I proposed to think about a preprocessor for standard-gcc to handle these rules and
pass everything unchanged.
AFAIR the most important memory management rules of ObjC 1.0 are:
-alloc and -copy* and -retain return a retained object which must be released before returning
from a method. Objects returned by a method must be (explicitly or implicitly)
retained+autoreleased.
Objects assigned to persistent store (instance vars) must be retained and the previous value
must be released before. This is (not necessarily) usually wrapped by a setter method.
These are not extraordinarily complex so I also tend to think that training is not well enough
if programmers struggle with them. But they obviously do.
Hm. Just some thought: is anyone is looking for a master's or PhD-thesis: would it be
possible to statically analyse retain/release/autorelease code to locate memory leaks
which come from not following these rules?
BTW note: Linux kernel also has trouble with non-automatic reference counting.
retain/release are called get and put there. E.g.:
But they don't have the nice autorelease-pool and the rule that most methods return
autoreleased objects and caller must retain them (they often return retained object
and caller must put them)...