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

Autofree in V #389

Open
OpenSourceAnarchist opened this issue Jan 15, 2022 · 2 comments
Open

Autofree in V #389

OpenSourceAnarchist opened this issue Jan 15, 2022 · 2 comments

Comments

@OpenSourceAnarchist
Copy link
Contributor

I am really interested in the V language, and I know their compiler supports the flag -autofree which is able to perform automatic memory management in order to significantly reduce memory leaks. It is still in development as a feature, but seems to work just fine for the majority of code. Since it's not enabled by default, or in this repo, perhaps a footnote for V's memory values should be added since the current numbers include memory leaks, without any freeing of memory (except for in the base64 benchmark it appears). Alternatively, -autofree could be tentatively enabled, but if any build or runtime errors occur, this could be reverted.

If -autofree is ever enabled, the manual freeing of memory in test.v should probably be removed since it's taken care of by the compiler.

@nuald
Copy link
Collaborator

nuald commented Jan 15, 2022

If there are some leaks, then I'd prefer them to be fixed. I don't have any preferences regarding automatic vs manual though, so if you're willing to address it, that would be greatly appreciated.

@OpenSourceAnarchist
Copy link
Contributor Author

I locally ran the benchmark suite with just V files and... without -autofree it works perfectly, but with it... for some reason it doesn't send any info over tcp, verified with netcat, so it won't work with your setup. I'm going to ask on the discord and probably file an issue about this. But until then, it's best to keep everything as-is. Idiomatic V doesn't call for unsafe blocks to manually free memory. -autofree should just work eventually, and will be the preferred way to think about memory management.

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