caml-list - the Caml user's mailing list
 help / Atom feed
From: Markus Mottl <markus.mottl@gmail.com>
To: OCaml List <caml-list@inria.fr>
Subject: [Caml-list] Keeping track of values on the external heap
Date: Mon, 28 Oct 2019 12:31:31 -0400
Message-ID: <CAP_800p37u7Ue_g5BHipCCHd4-=wqCMSdiNcZ4e4A2eke2qJ7Q@mail.gmail.com> (raw)

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

Hi,

the runtime has recently seen some improvements for keeping track of memory
resources on the external heap, e.g. `caml_alloc_custom_mem`.  Though we
can now tell the GC the exact size on the external heap that custom values
consume at allocation time, we also need to keep track of values whose
memory consumption may change over their lifetime.

I've seen the new functions `caml_alloc_dependent_memory` and
`caml_free_dependent_memory`.  They are not mentioned anywhere in the
manual, but judging from the comment in their implementation, they appear
to address the above mentioned problem.

Is it the correct intended use if I keep track of the size of a custom
value at allocation time and, if it changes later, to pass the size
difference to `caml_alloc_dependent_memory` if it is positive (i.e. the
value grew) and its absolute value to `caml_free_dependent_memory` if it is
negative (i.e. the value shrank)?

Best regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com

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

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publically 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='CAP_800p37u7Ue_g5BHipCCHd4-=wqCMSdiNcZ4e4A2eke2qJ7Q@mail.gmail.com' \
    --to=markus.mottl@gmail.com \
    --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

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror https://inbox.ocaml.org/caml-list

AGPL code for this site: git clone https://public-inbox.org/ public-inbox