Garbage collector memory leak "feature"?

0ffh spam at frankhirsch.net
Wed Oct 10 08:47:12 PDT 2007


David Brown wrote:
> On Wed, Oct 10, 2007 at 05:29:01PM +0200, 0ffh wrote:
>> No, only "conservative" gcs. There are also "exact" gc, but they have one
>> big drawback: No void* type at all is possible!
>> So either you want them, then you must use a conservative gc, or you 
>> don't then you can have an exact gc.
>> D wants void*, so there is just no way round.
> You can have limited void*, if you retain the types in the blocks that are
> allocated.  What you can't do is use casts to view things of one type as a
> different type.

If you always have to retain the types, what would be the use of void*s?
The point about them is that a void* may point to anything, pointers
included, which is what makes them painful for the gc.
Btw unions of pointer- and non-pointer types cause the same problem,
so it's not even all about void* (probably most, though).

>> It is not technically correct to call prudently retained memory blocks
>> a "memory leak". Those are distinct concepts, in my book at least.
> It depends on how much gets prudently retained.  My experience so far is
> that long-running programs continue to retain more and more memory.  I
> would certainly call this a leak.

IIRC it could be that the current GC doesn't use all of the available
information for collecting. It might be worthwhile to fix this, but
it's not trivial.

Regards, Frank



More information about the Digitalmars-d mailing list