caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Nicolas Boulay <nicolas@boulay.name>
To: Damien Pous <Damien.Pous@inria.fr>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] hook before gc major collections
Date: Tue, 7 Oct 2014 10:09:28 +0200	[thread overview]
Message-ID: <CAH+PdrDL-OgHqzVpU7AiwAthX82YGrrn4Jh9K0Mq=diZjc4+QA@mail.gmail.com> (raw)
In-Reply-To: <CAMy6byW5b_unsg-i8khBQ31KtjYB4kwn2DA6VzJBtdjn4adBtw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1058 bytes --]

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
>

[-- Attachment #2: Type: text/html, Size: 1794 bytes --]

  reply	other threads:[~2014-10-07  8:09 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 [this message]
2014-10-07  8:42   ` Damien Pous
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='CAH+PdrDL-OgHqzVpU7AiwAthX82YGrrn4Jh9K0Mq=diZjc4+QA@mail.gmail.com' \
    --to=nicolas@boulay.name \
    --cc=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;
as well as URLs for NNTP newsgroup(s).