From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id 3C8925D5 for ; Mon, 28 Oct 2019 16:32:35 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.68,240,1569276000"; d="scan'208,217";a="408858377" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 28 Oct 2019 17:32:34 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 0CC787F318; Mon, 28 Oct 2019 17:32:34 +0100 (CET) Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 4A48D7ED20 for ; Mon, 28 Oct 2019 17:32:30 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=markus.mottl@gmail.com; spf=Pass smtp.mailfrom=markus.mottl@gmail.com; spf=None smtp.helo=postmaster@mail-il1-f177.google.com IronPort-PHdr: =?us-ascii?q?9a23=3AVzTkORE2nItpljPrf2k2p51GYnF86YWxBRYc798d?= =?us-ascii?q?s5kLTJ7zp8WwAkXT6L1XgUPTWs2DsrQY0rGQ4vGrCTNIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+?= =?us-ascii?q?KPjrFY7OlcS30P2594HObwlSizexfL1/IA+yoAjVucUbgolvIbstxxXUpXdFZ/?= =?us-ascii?q?5Yzn5yK1KJmBb86Maw/Jp9/ClVpvks6c1OX7jkcqohVbBXAygoPG4z5M3wqBnM?= =?us-ascii?q?VhCP6WcGUmUXiRVHHQ7I5wznU5jrsyv6su192DSGPcDzULs5Vyiu47ttRRT1ky?= =?us-ascii?q?oMKSI3/3/LhcxxlKJboQyupxpjw47PfYqZMONycr7Bcd8GQGZMWNta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?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0D+CAC/F7ddgLGmVdFlgkOCRkSBByqEK?= =?us-ascii?q?IEcgl6LC5sqgXoJAQMBDAUWFAEBiAwcBwEENgQNAgwBAQQBAQECAQIDBAETAQE?= =?us-ascii?q?JDQkIJ4VADII7KQGDBREdARQHHgMSAwYBBjcCIwEBEQEFASITIoMBgkUBAy6VF?= =?us-ascii?q?IxxghyBAzyLJYEVBQEXgn8FhEkKGScNYwOBPAIHEoEljA6BWD+DdQEBgwWFOoJ?= =?us-ascii?q?eBK0nQQeCJwNmBIFGjm+EDBuZWph5jycPI4FJCEGBLjMaI4EBgjsJRxAUhnmCW?= =?us-ascii?q?YgWKDCQVAEB?= X-IPAS-Result: =?us-ascii?q?A0D+CAC/F7ddgLGmVdFlgkOCRkSBByqEKIEcgl6LC5sqgXo?= =?us-ascii?q?JAQMBDAUWFAEBiAwcBwEENgQNAgwBAQQBAQECAQIDBAETAQEJDQkIJ4VADII7K?= =?us-ascii?q?QGDBREdARQHHgMSAwYBBjcCIwEBEQEFASITIoMBgkUBAy6VFIxxghyBAzyLJYE?= =?us-ascii?q?VBQEXgn8FhEkKGScNYwOBPAIHEoEljA6BWD+DdQEBgwWFOoJeBK0nQQeCJwNmB?= =?us-ascii?q?IFGjm+EDBuZWph5jycPI4FJCEGBLjMaI4EBgjsJRxAUhnmCWYgWKDCQVAEB?= X-IronPort-AV: E=Sophos;i="5.68,240,1569276000"; d="scan'208,217";a="324865345" X-MGA-submission: =?us-ascii?q?MDH3R15JSweLR1oiHgKF0l+mq1/2Mj44/U4HZX?= =?us-ascii?q?jbDqMx5SbeAskzURPJRUD7kzzKtNKD1xL3vpAPuUCnkyYE2206vKqiWI?= =?us-ascii?q?PJexHyvtBtvnuB3Mp05WX4EM7oZMMcdLxa5PtUX4MIIQNyIB0zpuABph?= =?us-ascii?q?fkuUp+YL5vQdLLyXc01yX+PQ=3D=3D?= Received: from mail-il1-f177.google.com ([209.85.166.177]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 28 Oct 2019 17:31:45 +0100 Received: by mail-il1-f177.google.com with SMTP id o16so8712632ilq.9 for ; Mon, 28 Oct 2019 09:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=PQl6r9JqJ4DxudHsOJla7FUlIGBclKA9grJsz3fcxHU=; b=KiYspS0I8kHnujusfVj+ts2snTIB8jG+2w6E9A5fDTmHOCG05ANyyaxCwGCDW8Qnq3 9crgsATaXghbuiGqmmBH2YLbTFt/MKS4L8M3NaBqvyHhRo1WQPTgxEYHxptJHX0k8ZFL 9su8K55bYPSsXHDv+kCPDN81gFBnjCqpPrQh14A8icI6oR4pzrRM7AgpXZq3d/cHJ5qw Ei0Y7S9PrI5bz8BlrtCmTFvdbYOBMzap0LbYcwdoUZIU55sXcVVe6EjS5ZvvXPnfGvA1 t594NExwh0xPFF421+1XzrInq2a8ZlebBtMUjKWaT5dmVdWyJM/oMvGKn0SYLqQsGB9m fyzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=PQl6r9JqJ4DxudHsOJla7FUlIGBclKA9grJsz3fcxHU=; b=ZjQymw1CCEB8TypER3zKC424gxW8cSxeCstL6gZrDo1ub1uXEfXfGOm7BnIUinyoLS tTKFcYDmrq6XLLZuW32j50YwiEbP0ZWKCoCE/m4kBl4PZzU5IpNYogsoMNbaoHHGK52a +ClEEPBtvycryJhb+8HiIVx1lNumDndM9q+2nJtPP8ktT5LyyyWcb1aHlrU2U/ceVyV4 BI499H9eW2sCmKB+iiodjvceEqIFN1mkiH+XySw6hxbKSGdr4mHYuliQEKJYH1LCzISv FUaasgBGd/6ou6BnucJTeYfBjcNESw/cy9+G78DsF3/H/8kwLgqL+yGun049LU32IAAk KOZw== X-Gm-Message-State: APjAAAVjvvIMEahyWxxNGaNjhzH2SbKVVckDcAb8fXj0C5Dbn+3WDLE0 1QD4qHVg0LW4wR264I+NhUO/toW+eIIRWJzobc9pKuKKzzU= X-Google-Smtp-Source: APXvYqxu7jQK0Ngl+x10gFfwp/gGWcLvvKRufxZUI8/PYbDWDTujvXGzOhzVpZpKLt3aPlieHMtEUDfO0NLL+6/Ig0M= X-Received: by 2002:a92:b00f:: with SMTP id x15mr20534569ilh.280.1572280303126; Mon, 28 Oct 2019 09:31:43 -0700 (PDT) MIME-Version: 1.0 From: Markus Mottl Date: Mon, 28 Oct 2019 12:31:31 -0400 Message-ID: To: OCaml List Content-Type: multipart/alternative; boundary="000000000000f490770595fb080d" Subject: [Caml-list] Keeping track of values on the external heap Reply-To: Markus Mottl X-Loop: caml-list@inria.fr X-Sequence: 17853 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --000000000000f490770595fb080d Content-Type: text/plain; charset="UTF-8" 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 --000000000000f490770595fb080d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

the runtime has recently seen some = improvements for keeping track of memory resources on the external heap, e.= g. `caml_alloc_custom_mem`.=C2=A0 Though we can now tell the GC the exact s= ize 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 `c= aml_alloc_dependent_memory` and `caml_free_dependent_memory`.=C2=A0 They ar= e not mentioned anywhere in the manual, but judging from the comment in the= ir 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` i= f it is negative (i.e. the value shrank)?

Best reg= ards,
Markus

--
Markus Mottl=C2= =A0 =C2=A0 =C2=A0 =C2=A0 http://www.ocaml.info=C2=A0 =C2=A0 =C2=A0 =C2=A0 markus.mottl@gmail.com
--000000000000f490770595fb080d--