What are the prominent upsides of the D programming language?

mw mingwu at gmail.com
Wed Sep 23 04:04:04 UTC 2020

On Monday, 21 September 2020 at 11:04:43 UTC, Imperatorn wrote:
> Top reasons to use D instead of for example Rust, Julia, Go etc 
> :)

One of the upside of D I like is that one can mix GC with manual 
memory management:


which gives you the best of both world.

Currently I have a personal project, initially I was solely 
relying on GC just like in Java: allocate all the objects via 
`new`, and let the GC take care of all the bookkeeping. But there 
is a particular set of objects which takes the majority of memory 
consumption of the program, and even after I carefully removed 
all the reference after the object is no longer used, the program 
still use lots of memory because GC collection is un-predictable, 
both in terms of timing and efficiency.

Then I decided to do manual core.memory.GC.free just for that 
particular objects, (it was not very easy in a multi-threaded 
program to make all the logic right, but eventually I got it 
done). And the resulting program now only use ~10% of the memory 
it used to use.

I think this flexibility to mix GC & manual memory management is 
very unique in D. Actually I'm not sure if it can be done in 
other languages at all.

More information about the Digitalmars-d mailing list