December 09

I am new to the language and am curios about manual memory management options.

From what i can tell dlang offers the option for both manul and automatic management of memory resources.

The language provides the ability to create your own allocator which is nice but i am a bit confused about the the situation with delete. The documentation states that it is deprecated and that __delete if you realy have to.

However GC.free apears to do the same thing (dealocate memory alocated by the GC) so the question is can memory alocated with new be dealocated with free or is it like like c/c++ where you are not allowed to mix the 2?

In addition is it posible to controll when the GC runs, i know of the existance of enable, disable and collect however it is not clear about the behaviour.

Does disable simply pause the GC automatic collection or does it behave like @nogc where you cant use heap memory at all and can collect be called when disable is in force or do i need to call enable 1st.

December 09

On Saturday, 9 December 2023 at 10:12:11 UTC, Vlad Stanimir wrote:

>

I am new to the language and am curios about manual memory management options.

From what i can tell dlang offers the option for both manul and automatic management of memory resources.

You might find all the answers in this blog series

https://dlang.org/blog/the-gc-series/

-Steve