From: Damien Pous <Damien.Pous@inria.fr>
To: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] hook before gc major collections
Date: Tue, 7 Oct 2014 10:42:01 +0200 [thread overview]
Message-ID: <CAMy6byUkSxwu-Xw4j4QaXcUPUK6gM3MkLD0RXy5ZHQn67_km2w@mail.gmail.com> (raw)
In-Reply-To: <CAH+PdrDL-OgHqzVpU7AiwAthX82YGrrn4Jh9K0Mq=diZjc4+QA@mail.gmail.com>
I would like to, but Weak provides sets while I need maps...
(i.e., I would be somehow happy if Weak.Make did implement Hashtbl.S
rather than Weak.S)
To be more precise, the indices of my maps are hash-consed values, and
I use Jean-Christophe Filliatre's hash-consing library.
In my current code, the maps are thus Patricia trees (Filliatre's Hmap
module) ; it seems non-trivial to reimplement such maps in a
phantomatic way, using Weak in the background.
Do I miss an obvious usage of Weak.S?
Damien
2014-10-07 10:09 GMT+02:00 Nicolas Boulay <nicolas@boulay.name>:
> 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 <Damien.Pous@inria.fr>:
>>
>> 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
>
>
next prev parent reply other threads:[~2014-10-07 8:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 8:05 Damien Pous
2014-10-07 8:09 ` Nicolas Boulay
2014-10-07 8:42 ` Damien Pous [this message]
2014-10-07 9:12 ` Virgile Prevosto
2014-10-07 9:01 ` Fabrice Le Fessant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMy6byUkSxwu-Xw4j4QaXcUPUK6gM3MkLD0RXy5ZHQn67_km2w@mail.gmail.com \
--to=damien.pous@inria.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox