How to use D without the GC ?

Dukc ajieskola at gmail.com
Wed Jun 12 21:36:30 UTC 2024


bachmeier kirjoitti 12.6.2024 klo 18.21:
> You're splitting things into GC-allocated memory and manually managed 
> memory. There's also SafeRefCounted, which handles the malloc and free 
> for you.

I suspect `SafeRefCounted` (or `RefCounted`) is not the best fit for 
this scenario. The problem with it is it `malloc`s and `free`s 
individual objects, which doesn't sound efficient to me.

Maybe it performs if the objects in question are big enough, or if they 
can be bundled to static arrays so there's no need to refcount 
individual objects. But even then, you can't just allocate and free 
dozens or hundreds of megabytes with one call, unlike with the GC or 
manual `malloc`/`free`. I honestly don't know if calling malloc/free 
for, say each 64KiB, would have performance implications over a single 
allocation.


More information about the Digitalmars-d-learn mailing list