Re: Aliasing and Garbage Collection

From: Tom Locke (tsl2_at_email.domain.hidden)
Date: 2000-10-17 16:13:58


Hi

> Some more remarks on the performance overhead of Garbage Collection:
> The overhead of Garbage Collection can be O(#pointercopies).
> Use the following scheme:
> - when allocating a memory fragment, register the object is shared
> once "shareCount = 1"
> - when copying a pointer, register the object is shared once more
> "shareCount++"
> - register the release of a pointer.
> void free { sharedCount--; if (sharedCount==0) { call private free } }

Reference counting is subject to memory leaks when cycles exist. Object A
contains a ptr to B, B contains a ptr to A, but both are unreachable from
the program. They are not reclaimed as both have a sharedCount of 1.

Algorithms which do not suffer from this problem are (I believe)
considerably more expensive.

Tom.


Original text of this message

This archive was generated by hypermail 2.1.7 on 2004-10-31 20:03:55 GMT
© Copyright WoTUG
All rights reserved