Skip to content

[BUG] Fix implementation of ephemerons #1704

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

Closed
vouillon opened this issue Oct 4, 2024 · 0 comments
Closed

[BUG] Fix implementation of ephemerons #1704

vouillon opened this issue Oct 4, 2024 · 0 comments
Labels

Comments

@vouillon
Copy link
Member

vouillon commented Oct 4, 2024

Currently, we have a strong reference to the data. So, if the data references one of the keys, it will never be released.

The implementation in wasm_of_ocaml uses a chain of WeakMaps: to access the data, we iteratively perform a lookup using each key in turn.

The implementation is also probably racy. It uses a FinalizationRegistry which is asynchronous. So, a newly set data might get deleted if the previous data was considered as garbage. This is probably no longer an issue since ephemerons are immutable since OCaml 5.0.0.

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

No branches or pull requests

2 participants