From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr 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 4EC137F057 for ; Tue, 7 Oct 2014 10:42:03 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of damien.pous@gmail.com) identity=pra; client-ip=209.85.214.182; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="damien.pous@gmail.com"; x-sender="damien.pous@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of damien.pous@gmail.com designates 209.85.214.182 as permitted sender) identity=mailfrom; client-ip=209.85.214.182; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="damien.pous@gmail.com"; x-sender="damien.pous@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ob0-f182.google.com) identity=helo; client-ip=209.85.214.182; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="damien.pous@gmail.com"; x-sender="postmaster@mail-ob0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqgBAD6mM1TRVda2m2dsb2JhbABfg2FNCwSCfrg0kRuIVggWAREBAQEBAQYLCwkULIQEAQEEEhEdARIbDAMMAQUFCw8CCR0CAiISAQUBChIGEwgKEIgIAxENoCVuizCFAohKJwMKhx0BBQ6BHpIXgVQFhRUFkRaHDoFokiYYKYFsgTEegVs7LwGCSQEBAQ X-IPAS-Result: AqgBAD6mM1TRVda2m2dsb2JhbABfg2FNCwSCfrg0kRuIVggWAREBAQEBAQYLCwkULIQEAQEEEhEdARIbDAMMAQUFCw8CCR0CAiISAQUBChIGEwgKEIgIAxENoCVuizCFAohKJwMKhx0BBQ6BHpIXgVQFhRUFkRaHDoFokiYYKYFsgTEegVs7LwGCSQEBAQ X-IronPort-AV: E=Sophos;i="5.04,668,1406584800"; d="scan'208";a="82236620" Received: from mail-ob0-f182.google.com ([209.85.214.182]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 07 Oct 2014 10:42:02 +0200 Received: by mail-ob0-f182.google.com with SMTP id uy5so5366108obc.27 for ; Tue, 07 Oct 2014 01:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=u2Q1733dwIJHCChntDQx9r4dUd6rDudA24bbvrtx26I=; b=TqC/rvEI4BIseoOqQ080HcqQ/fLkUZLD6a8IKsR9USgU0bCdkbYkg/QPg0Ynf4hamF OdgbaeP4GC8V0duj+M0D8S+2EMAH2IKeQHYo8iYGe2ocpTGCYMCRPGuXWr8VbD9gZtO6 rArnittutsK+w6Ylp7+q79iRcd1CY0UKH9k2DUtJYihLpjLF3YIMqKGdaMcrSInnFiQt AJrnVl8Jnw6kIiCEHQLr4k/BtQkc+QYjzoJzItrAUUzc8SyEgIsk6JJFpwwLlznJ5piv 4DDuG4c2AqHQAfihWxBVNjxIpepGZ2R3CmGW3g4KttyydENr1RZ8MyxCEd/D5meTF8Vw gJLA== MIME-Version: 1.0 X-Received: by 10.182.119.230 with SMTP id kx6mr2236907obb.72.1412671321067; Tue, 07 Oct 2014 01:42:01 -0700 (PDT) Sender: damien.pous@gmail.com Received: by 10.202.211.149 with HTTP; Tue, 7 Oct 2014 01:42:01 -0700 (PDT) In-Reply-To: References: Date: Tue, 7 Oct 2014 10:42:01 +0200 X-Google-Sender-Auth: tjiIbuZS5ezZKUNJl-0CDnjDiLM Message-ID: From: Damien Pous To: caml-list Content-Type: text/plain; charset=UTF-8 X-Validation-by: damien.pous@inria.fr Subject: Re: [Caml-list] hook before gc major collections 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 : > 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 > >