caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Ephemerons: is this behavior correct ?
@ 2016-10-10 13:14 Bertrand Jeannet
  2016-10-10 13:38 ` François Bobot
  0 siblings, 1 reply; 3+ messages in thread
From: Bertrand Jeannet @ 2016-10-10 13:14 UTC (permalink / raw)
  To: caml-list

Dear list,

The following piece of code raises an assert false exception (in rare 
cases) with official version 4.03.0:

match Ephemeron.K1.get_data c with
| Some _ ->
   match Ephemeron.K1.get_key c with
   | Some _ -> (* ... *)
   | None -> assert false (* reachable *)

Before I had called the function K1.set_key_data with a key
* that belongs to a weak hashed set
* and that is used after the call
(this may be important or not).

The documentation of the Ephemeron module says:
"When one of the keys is not considered alive anymore by the GC, the 
data is emptied from the ephemeron"

I was expecting this to happen atomically from the programmer point of 
view, but here apparently the key was emptied but the data kept (at 
least temporarily).

Was this behavior anticipated ?

IMHO, synchronized deletion is simpler and safer (in previous versions, 
I encountered the now-solved-bug that the deletion of several weak 
pointers to the same object was not synchronized).

Btw, the Ephemeron module does not appear on this url:
http://caml.inria.fr/pub/docs/manual-ocaml/stdlib.html
one has to go to
http://caml.inria.fr/pub/docs/manual-ocaml/libref/index.html

Best regards

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-10 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-10 13:14 [Caml-list] Ephemerons: is this behavior correct ? Bertrand Jeannet
2016-10-10 13:38 ` François Bobot
2016-10-10 16:49   ` Bertrand Jeannet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).