Componentizing D's garbage collector

Walter Bright newshound2 at digitalmars.com
Mon Jan 13 12:44:13 PST 2014


On 1/12/2014 2:40 AM, Benjamin Thaut wrote:
> Am 12.01.2014 11:27, schrieb Rainer Schuetze:
>>
>> I think a moving collector is currently not feasible without restricting
>> the language a lot, probably similar to safe D and more. I'm not sure we
>> want that in general.
>>
>
> Could you give an example which part of the language would not be doable with a
> moving collector? The only thing that comes to my mind is unions and that
> problem can be solved by allowing the user to specify manual scanning functions
> for structs or classes containing unions.
>
> Also I don't think that we can create a GC which performs as good as the one of
> Java or C# if we are not willing to make the neccessary changes for a moving gc.


A moving GC is already supported by D's semantics.

Unions are dealt with by 'pinning' those objects, i.e. simply don't move them. I 
know this can work because I implemented a mostly copying generational collector 
years ago for Java. (After I invented this, someone else came out with a paper 
about a "mostly copying" collector, so I didn't get any credit. Oh well! But the 
idea is sound and it works in the real world.)


More information about the Digitalmars-d mailing list