|Anonymous | Login | Signup for a new account||2019-02-24 01:40 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0007210||OCaml||runtime system and C interface||public||2016-04-04 11:44||2016-12-08 08:41|
|Target Version||Fixed in Version||4.04.0|
|Summary||0007210: Finaliser that are really called when a value will be freed.|
|Description||Since the values finalized are given as argument of their finalizers, they are kept alive. So you can't be sure that nobody will ever use this value again.|
Before 4.03 the finalizer where called after cleaning weak pointers, thus possibly breaking invariant of weakset, hashconsing. In 4.03 they are called before cleaning weak pointers (which is done when we are sure to sweep the value).
It could be interesting to give the possibility to register finalizers that would not take the value as argument but instead `unit` and would be called when we are sure to sweep the value.
The question is not really how to add this feature (straightforward), more if ocaml needs it.
|Tags||No tags attached.|
This would be very useful in combination with weak pointers.
As of 4.03, it is difficult to "clean up" a data structure containing a weak pointer when the weak pointer is cleared (e.g. removing an entry from a weak hash table once its weak pointer is empty). Previously this could be done with ordinary finalisers, but that is no longer possible since finalisers are now run before weak pointers are cleared.
Ordinary finalisers are now run before clearing weak pointers to make sure that weak pointers are only cleared once the object is genuinely dead -- a useful invariant for things like hash-consing. Since the proposed alternative finalisers do not receive their argument and cannot bring it back to life, they can safely be run after weak pointers have been cleared without breaking the desired invariant on weak pointers.
|GPR at https://github.com/ocaml/ocaml/pull/562 [^]|
|Fixed in 4.04|
|2016-04-04 11:44||bobot||New Issue|
|2016-04-18 15:00||lpw25||Note Added: 0015783|
|2016-04-27 14:25||bobot||Note Added: 0015877|
|2016-05-02 15:30||doligez||Status||new => acknowledged|
|2016-12-08 08:40||shinwell||Note Added: 0016813|
|2016-12-08 08:41||shinwell||Status||acknowledged => resolved|
|2016-12-08 08:41||shinwell||Fixed in Version||=> 4.04.0|
|2016-12-08 08:41||shinwell||Resolution||open => fixed|
|2016-12-08 08:41||shinwell||Assigned To||=> shinwell|
|2017-02-23 16:43||doligez||Category||OCaml runtime system => runtime system|
|2017-03-03 17:45||doligez||Category||runtime system => runtime system and C interface|
|Copyright © 2000 - 2011 MantisBT Group|