On Friday, 15 January 2021 at 11:28:55 UTC, Ola Fosheim Grøstad wrote:
On Friday, 15 January 2021 at 11:11:14 UTC, Mike Parker wrote:
That's the whole point of being able to mix and match. Anyone avoiding the GC completely is missing it (unless they really, really, must be GC-less).

Has DMD switched to using the GC as the default?

No. And it will never will. Currently DMD uses custom allocator for almost everything. It works as follows. Allocate a big chunk(1MB) of memory using malloc. Have a internal pointer that points to the beginning of unallocated memory. When someone ask for memory return that pointer and increment internal pointer with the 16 byte aligned size of allocation. Meaning the new pointer is pointing to unused memory and everything behind the pointer has been allocated. This simple allocation strategy is called bump the pointer and it improved DMD performance by ~70%.

You can use GC with D compiler by passing -lowmem flag. I didnt measure but I heard it can increase compilation time by 3x.

https://github.com/dlang/dmd/blob/master/src/dmd/root/rmem.d#L153

Reply via email to