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

[github patch] Ephemerons #6353

Closed
vicuna opened this issue Mar 26, 2014 · 2 comments
Closed

[github patch] Ephemerons #6353

vicuna opened this issue Mar 26, 2014 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Mar 26, 2014

Original bug ID: 6353
Reporter: @gasche
Status: closed (set by @alainfrisch on 2016-01-27T08:23:59Z)
Resolution: duplicate
Priority: normal
Severity: feature
Target version: 4.03.0+dev / +beta1
Category: runtime system and C interface
Monitored by: @yallop

Bug description

Discussion and description at:
#22

Ephemerons

The current OCaml runtime proposes two kinds of pointers:
A points hardly to B: if A is alive, B is alive (usual pointers)
A points weakly to B: when the GC decide that B stops to be alive, A stops to point to B

Weak pointers are very handy when you want to be able to access a data without creating memory leaks. For example hashconsing can be done using the weaksets defined in Weak.Make. However you can't create general weaktable with the current runtime: associative table that keep a data until the key is not needed anymore. The problematic case is when the data points to the key.

Barry Hayes proposed in 1997 the notion of ephemerons which allow to code such table. In its simplest form an ephemeron A with key K and data D keeps D alive while A and K are alive. To sum up ephemerons add the possibility to express conjunctions where you normally have only disjunctions.

Request for Comment and Merge-Request

This merge-request adds ephemerons to ocaml with particularly a modification of the runtime, and a new module in the standard library. An untyped API with an arbitrary number of keys is given in Ephemerons.Obj and two specialized API for one and two keys are provided in Ephemerons.K1 and Ephemerons.K2. Each of these three APIs define a functor for constructing weaktables with the same signature than Hashtbl.

@vicuna
Copy link
Author

vicuna commented Jul 16, 2014

Comment author: @damiendoligez

Ephemerons missed the feature deadline for 4.02 because of license issues but I hope they'll be included for 4.03.

@vicuna
Copy link
Author

vicuna commented Jan 27, 2016

Comment author: @alainfrisch

Closing this ticket. The progress is tracked on the Github PR.

@vicuna vicuna closed this as completed Jan 27, 2016
@vicuna vicuna added this to the 4.03.0 milestone Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant