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?
> "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
Completely avoiding the question about D, all it says in that
"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