Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain memory safety more #129

Open
mverleg opened this issue Feb 10, 2020 · 1 comment
Open

Explain memory safety more #129

mverleg opened this issue Feb 10, 2020 · 1 comment

Comments

@mverleg
Copy link

mverleg commented Feb 10, 2020

The main thing that confused me when reading through docs is the memory safety.

It mentions some cool things:

  • There's no garbage collection or reference counting
  • V cleans everything up during compilation
  • If your V program compiles, it's guaranteed that it's going to be leak free

I'm not an expert about this, so I got a bit confused. Rust had to make some substantial language changes compared to most languages to achieve this (and then still has Rc wrapper). And not a lot of other languages have managed.

So how exactly does it work in V? The docs don't mention much in the way of language changes to support this. What's the difference with Go that V can do this and Go can't?

I was going to experiment to figure it out, but ran into problems (can't mutate list arguments, another program failed to compile). So I'll post it here - I bet I'm not the only one interested in info.

@Congyuwang
Copy link

Exactly, seems to me V will have to handle special case after special case in the future, and there won't be an end, if the memory management model does not give a logical memory safety guarantee.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants