Skip to content

Autofree in V #389

Open
Open

Description

@OpenSourceAnarchist

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.

Activity

  1. nuald commented on Jan 15, 2022

    @nuald
    Collaborator

    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.

  2. OpenSourceAnarchist commented on Jan 16, 2022

    @OpenSourceAnarchist
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions