|
![](/i/fill.gif) |
Am 14.03.2012 18:16, schrieb Warp:
> clipka<ano### [at] anonymous org> wrote:
>> Then again, how would any other GC prevent this kind of thing happening?
>
> A GC keeps track of *all* the references that are pointing to an object,
> including the 'this' pointer (or whatever the equivalent is in any given
> language).
>
> You could avoid this problem in a reference-counted scenario by
> incrementing the reference count in the beginning of the function and
> decrementing it when exiting the function, but that's burdensome and
> makes member functions less efficient (especially if they are supposed
> to be fast).
But doesn't the "this-pointer tracking" in a reference-tracking GC
approach incur approximately that very same penalty?
Post a reply to this message
|
![](/i/fill.gif) |