Memory management

Ali Çehreli acehreli at yahoo.com
Tue Sep 29 15:47:09 UTC 2020


On 9/29/20 3:57 AM, 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."

I am not a language expert but I can't imagine how the compiler knows 
whether an event will happen at runtime. Imagine a server program 
allocates memory for a client. Let's say, that memory will be 
deallocated when the client logs out or the server times that client 
out. The compiler cannot know either of that will ever happen, right?

Ali



More information about the Digitalmars-d-learn mailing list