The GC (agian)

Imperatorn johan_forsberg_86 at hotmail.com
Tue Nov 23 13:46:28 UTC 2021


On Tuesday, 23 November 2021 at 07:14:17 UTC, bauss wrote:
> On Sunday, 21 November 2021 at 09:29:10 UTC, Imperatorn wrote:
>>
>> I get the feeling that maybe what's missing is just confidence 
>> in the system. Are there good documentation about this for 
>> example? Some walk through? Videos with evidence that the GC 
>> is not touching @nogc etc?
>>
>
> The GC will never touch @nogc because @nogc will have the 
> compiler verify that any operation you do in such scope doesn't 
> allocate using the GC.
>
> Which means the GC has no idea allocated memory in the scope 
> actually exist.
>
> The GC doesn't work by scanning memory and figuring out whether 
> a block of memory is GC allocated or not.
>
> The GC works by having a set of nodes that it scans through and 
> checks whether they have any references pointing to them.
>
> All nodes of course refer to GC allocations. Ex. when you 
> allocate memory for a class then a node for said class will be 
> added to the GC and scanned.

**We** know that the GC doesn't do that. But can we *prove* it to 
those in doubt?

I get the feeling that some ppl still believe the GC sneaks in 
some backdoor and says hello


More information about the Digitalmars-d mailing list