On Sep 10, 2009, at 8:41 AM, Clark Cox wrote:
Yes, this can have unfortunate
side-effects for the Obj-C GC in MacOS X; No, this is not an issue of
GCC/clang not conforming to 6.2.4.
I agree this isn't a conformance issue, but the GC side effects are
worth focusing on, regardless. I haven't run into them myself, but I
haven't developed any really major apps with GC yet (just my
Mercurial client Murky.)
Off-list I suggested to an Apple engineer that the compiler should
avoid optimizing away stack storage of local variables that point to
Obj-C objects, when GC is enabled. The response was that this had
been investigated but led to too much heap growth (i.e. too many
actual garbage objects being held onto by unused local variables.)
Not sure what else to suggest. It seems there needs to be a way to
explicitly mark that you're keeping a reference to an object, since
declaring a local variable pointing to it isn't sufficient. Maybe
some sort of "__dont_optimize_away" annotation on the local variable?