Am Fri, 12 Sep 2014 15:43:14 +0000 schrieb "Chris" <[email protected]>:
> [Caveat: I'm no expert] > I once read a manual that explained the GC in Objective-C (years > ago). It said that some objects never get collected although > they're dead, but the garbage collector can no longer reach them. > But maybe that's true of other GC implementations too (Java?). With only ARC, if two objects reference each other, they keep each other alive indefinitely unless one of the references is a "weak" reference, which doesn't count as a real reference count and will cause the destruction. Other than that, in case of Java or D it is just a question of how you define "never" I guess. Since a tracing GC only runs every now and then, there might be uncollected dead objects floating around at program termination. > [...] But that's not really a GC algorithm that scans and > collects during runtime. Isn't it cheating? A GC algorithm that scans and collects during runtime is called a "tracing GC". ARC none the less collects garbage. You, the programmer, don't need to do that. -- Marco
