Do you use D's GC?

Adam D Ruppe destructionator at gmail.com
Sun Aug 1 11:26:18 UTC 2021


On Sunday, 1 August 2021 at 10:36:52 UTC, IGotD- wrote:
> will the GC then start to scan all those gigabytes of data?

the GC will only scan blocks that might have pointers in them. so 
let's say you have objects like

class Thing {
    ubyte[] imageData;

    this() {
        imageData = new ubyte[](10_000_000);
    }
}


A GC scan of that is actually only like 64 bytes since it knows 
it doesn't need to look at the image data, only the class and the 
stack which can actually hold pointers.


More information about the Digitalmars-d mailing list