One awesome GC feature we will use in Mir!

9il ilyayaroshenko at gmail.com
Tue Sep 18 17:09:32 UTC 2018


On Tuesday, 18 September 2018 at 16:19:23 UTC, Vladimir Panteleev 
wrote:
> On Tuesday, 18 September 2018 at 14:23:44 UTC, 9il wrote:
>> I just remember that D's GC has NO_SCAN [1] attribute!
>>
>> This will be added by default when for Mir allocations if type 
>> representation tuple has not references. For example, are 
>> Slice!(double*, 2) should never be scanned by GC, but it will 
>> be in GC heap until something refers it.
>
> Not sure if this is what you mean or not, but the D GC already 
> doesn't scan types which do not contain references. This was 
> added in D 1.000, see TypeInfo.flags&1. NO_SCAN is a way to 
> further override that.

Ah, awesome! Did not know about it. Need to review all 
allocations this allocations in Mir anyway.

> If you mean that Slice itself (when on the heap) should not be 
> scanned by the GC, I'm not sure that's a good idea. Is it not 
> conceivable that a Slice would be the only reference left 
> pointing at a block of memory in the heap?

Sure, Slice with GC allocated pointer should be referenced (btw, 
it is struct).


More information about the Digitalmars-d mailing list