Future of memory management in D

jmh530 john.michael.hall at gmail.com
Wed Nov 17 13:56:47 UTC 2021


On Wednesday, 17 November 2021 at 10:59:19 UTC, IGotD- wrote:
> [snip]
> The benefit of a special type for managed pointers is that you 
> can change the implementation of the GC fairly easily as well 
> as incorporate metadata under the hood. Tracing GC is not 
> suitable for low latency programs/embedded, but reference 
> counting can be a viable alternative for the low latency 
> programs.

Thanks. I now remember that this might have come up before.

I get the idea that tracing GC and reference counting are useful 
in different programs. However, I understand that it is possible 
to switch out D's GC, though that may not be so easy. Could you 
explain a bit more how having two different pointer types helps 
with switching out the GC?

Also, suppose std.allocator gets put in Phobos. We can currently 
use the gc_allocator, would it be possible to also create an 
rc_allocator? Is the issue that the pointer of gc_allocator is a 
normal pointer, but rc_allocator would need one wrapped with 
additional metadata?


More information about the Digitalmars-d mailing list