More precise GC

Robert Jacques sandford at jhu.edu
Sun Mar 28 20:30:32 PDT 2010


On Sun, 28 Mar 2010 16:16:41 -0300, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Sun, 28 Mar 2010 12:50:20 -0400, bearophile  
> <bearophileHUGS at lycos.com> wrote:
>
>> Robert Jacques:
>>
>>> What I think you're forgetting is that all compile-time type info is  
>>> lost at runtime. [... etc]<
>>
>> Thank you very much for all your explanations, I didn't know that the  
>> situation is so terrible. I suddenly like not-GC languages more :-)
>> I think the compilation of D code must build a data structure that will  
>> be used at runtime by the GC to know the type of all variables and  
>> pointers, otherwise there's no hope in a GC that works well in  
>> long-running programs.
>
> The current GC has a simple "type info" if you will -- contains pointers  
> or doesn't contain pointers.  It doesn't mean we cannot add to that.  In  
> fact, I think dsimcha has provided a way to have precise scanning for  
> heap-allocated types.  I don't think a reasonably precise GC is out of  
> the question.  However, it may be too much to require the GC to do  
> semantic analysis of enums for unions.  Not impossible, but probably not  
> worth the effort and restrictions necessary.
>
> -Steve

Also, don't forget that classes have a bunch of runtime type info.



More information about the Digitalmars-d mailing list