Memory management

bachmeier no at spam.net
Tue Sep 29 19:00:46 UTC 2020


On Tuesday, 29 September 2020 at 10:57:07 UTC, novice3 wrote:
> Naive newbie question:
>
> Can we have (in theory) in D lang memory management like V lang?
>
> Quote:
>   
> https://github.com/vlang/v/blob/master/doc/docs.md#memory-management
>
> "V doesn't use garbage collection or reference counting. The 
> compiler cleans everything up during compilation. If your V 
> program compiles, it's guaranteed that it's going to be leak 
> free."

Completely avoiding the question about D, all it says in that 
section is

"The strings don't escape draw_text, so they are cleaned up when 
the function exits.

In fact, the first two calls won't result in any allocations at 
all. These two strings are small, V will use a preallocated 
buffer for them."

That's a toy example. It would be hard to mess that up in C, and 
I'd expect it to be easy for the compiler to handle it.


More information about the Digitalmars-d-learn mailing list