Why do you not use "weak" pointer semantic ? http://caml.inria.fr/pub/docs/manual-ocaml/libref/Weak.html 2014-10-07 10:05 GMT+02:00 Damien Pous : > Hello, > > Is there a way to register a function, to be called before each gc > major collection ? > (I have some cache tables which I'd like to empty from time to time - > I'm not sure this is a good idea, but I would like to experiment it.) > > I see two related functions in the std lib, but not the precise thing I > want: > - Gc.create_alarm, to register a function to be called *after* such > collections ; > - Gc.finalise, which I could use with a dummy heap allocated value, > but then I guess my function would be called before any gc *minor* > collection, which is certainly too often in my concrete use-case. > > Thanks in advance, > Damien > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >