D programming language popularity

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun Nov 8 18:17:09 UTC 2020


On Sunday, 8 November 2020 at 17:38:01 UTC, random wrote:
> On Sunday, 8 November 2020 at 13:39:17 UTC, Ola Fosheim Grøstad 
> wrote:
>> On Sunday, 8 November 2020 at 13:28:02 UTC, random wrote:
>>> If I understand it right you also can't have a GC with heap 
>>> compaction in D, because this would invalidate pointers. Most 
>>> high performance GCs use heap compaction...
>>
>> It is possible, but expensive..
>
> How would you do this? Track all pointers (type system knows 
> them) and if you move the object update all pointers to that 
> object. What is with something evil like C++ iterator::end(), 
> which is often a pointer one past the last valid element in the 
> buffer? I think you would have to track for all pointers to 
> which GC allocated object they belong...

I wouldnt... But yes you could have many generation buckets and 
move 2 old near empty buckets to a new one if the static analysis 
tells you it is safe... I wouldnt compact all buckets every 
collection cycle.

I would probably change the semantics so that you need to hold 
array ownership through a slice, then you can compact arrays. 
Keep only elements reachable from active slices.
  it would be a breaking change.

> This is not completely clear to me. Do you mean (like you said 
> previously) that an other pointer type is needed so GC can 
> differentiate between them?

Yes, basically.




More information about the Digitalmars-d mailing list