Skip to content

[BUG] Fix implementation of ephemerons #1704

@vouillon

Description

@vouillon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions