DEV Community

Discussion on: V Programming Language

Collapse
 
idanarye profile image
Idan Arye

memory management like Rust

I wonder about that. According to vlang.io/docs#memory, memory management is "Work in progress" - so I wonder how much of it actually works well yet.

To get its memory management, Rust had to use linear typing and introduce the concept of lifetimes, making the language as complex as it is. Did V really manage to get this type of memory management to work without lifetime notation? Or is it WIP because they are still trying to figure it out?

Collapse
 
delta456 profile image
Swastik Baranwal

Currently there are many memory leaks. Only some of them are fixed. It still needs an AST and it is said to be in progress and its being worked on rapdily
The docs are currently outdated because of fast pace of development if I recall correctly.

Collapse
 
delta456 profile image
Swastik Baranwal

Here's the memory model they are gonna follow aardappel.github.io/lobster/memory...

Collapse
 
idanarye profile image
Idan Arye

So basically is uses reference counting but runs aggressive lifetime analysis to convert as many strong references to weak ones, to reduce the number of actual RC updates, and if possible even put the value on the stack and avoid heap allocation altogether?

And the compiler will do all that in super blazing fast speed?

Thread Thread
 
delta456 profile image
Swastik Baranwal

Probably. I don't if this will slow down the compile speed because I am not the creator V lang.