Skip to content

implements virtual threads to fix the remaining allocator bugs for good - #26043

Open
Araq wants to merge 4 commits into
develfrom
araq-alloc-improvements
Open

implements virtual threads to fix the remaining allocator bugs for good#26043
Araq wants to merge 4 commits into
develfrom
araq-alloc-improvements

Conversation

@Araq

@Araq Araq commented Jul 27, 2026

Copy link
Copy Markdown
Member

No description provided.

@Araq

Araq commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

Ping @SirOlaf ; this was my solution

@arnetheduck

Copy link
Copy Markdown
Contributor
  • what about foreign threads / those not created by createThread?
  • how do you create a leak-free program, ie how can you fully deinit the runtime (for example if it's running like a plugin in an .so that gets unloaded and reloaded?

@Araq

Araq commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

@arnetheduck the API already exists:

  proc setupForeignThreadGc*() {.gcsafe.}
  proc tearDownForeignThreadGc*() {.gcsafe.}

@SirOlaf

SirOlaf commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

I am realizing that the allocator is near-impossible to benchmark properly and every tiny layout change will cause a regression somewhere while another random benchmark suddenly performs better.
If virtual threads can be made to work safely they are going to be superior in that sense, but foreign threads will run into very similar issues to the ones I have been dealing with.

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

Successfully merging this pull request may close these issues.

3 participants