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 DB6D77F02D for ; Tue, 7 Oct 2014 11:02:20 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of fabrissimo@gmail.com) identity=pra; client-ip=209.85.216.173; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="fabrissimo@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of fabrissimo@gmail.com designates 209.85.216.173 as permitted sender) identity=mailfrom; client-ip=209.85.216.173; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="fabrissimo@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-qc0-f173.google.com) identity=helo; client-ip=209.85.216.173; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="postmaster@mail-qc0-f173.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqYBACirM1TRVditm2dsb2JhbABfhDkEgn7SJggWAREBAQEBAQYLCwkULIQEAQEEEhEdATgBAwwBBQULDQICJgICIhIBBQEcBhMiiAgDEaAxboswhQKITCcNhx0BBQ6BHpIXgVQFnT6BLZBUgg0YKYFsgyo7L4JKAQEB X-IPAS-Result: AqYBACirM1TRVditm2dsb2JhbABfhDkEgn7SJggWAREBAQEBAQYLCwkULIQEAQEEEhEdATgBAwwBBQULDQICJgICIhIBBQEcBhMiiAgDEaAxboswhQKITCcNhx0BBQ6BHpIXgVQFnT6BLZBUgg0YKYFsgyo7L4JKAQEB X-IronPort-AV: E=Sophos;i="5.04,668,1406584800"; d="scan'208";a="82240395" Received: from mail-qc0-f173.google.com ([209.85.216.173]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 07 Oct 2014 11:02:19 +0200 Received: by mail-qc0-f173.google.com with SMTP id x13so5259860qcv.32 for ; Tue, 07 Oct 2014 02:02:18 -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:from:date:message-id :subject:to:cc:content-type; bh=450T5vI1fa+U2PMbBiERYCeYkW1orY+Wkxxfrelf8/Y=; b=x/vJyJLG//DBol5zSShOYSmCWiVRm1bHE+qZIuNP8p6olJetZW1GtLwtPp/AlZyUCC SkXYhSviA1Ak0hl2ANiKX0TvTAotBHb/e89ROz7ZDNr6uTNSABdx6l7Nm07kdwYT78PC pVS83hBXp35dPL8DJfuyhqXKNUrYKLH41fC9l8iBK3oTTk7VWM3gNUDPqZqSb2DJOLHP HJ0udljTCZpda+GyoN9EoG6pGm+LieGTXkyEc+ssVI02UP7wJb60vpyFhfUHUo37ICym iydAd8SbCi9CBg+RHmphaTrQ7K57PTDnFz+VFhBgf/6jWHPEJ0Fue2wxgpoBkrNZEZ9F 2CbA== X-Received: by 10.229.94.135 with SMTP id z7mr2394247qcm.26.1412672538433; Tue, 07 Oct 2014 02:02:18 -0700 (PDT) MIME-Version: 1.0 Sender: fabrissimo@gmail.com Received: by 10.96.185.35 with HTTP; Tue, 7 Oct 2014 02:01:58 -0700 (PDT) In-Reply-To: References: From: Fabrice Le Fessant Date: Tue, 7 Oct 2014 11:01:58 +0200 X-Google-Sender-Auth: _Tvdlyf69qd9G4L-6PkfL4SFx9Y Message-ID: To: Damien Pous Cc: caml-list Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] hook before gc major collections On Tue, Oct 7, 2014 at 10:05 AM, Damien Pous wrote: > 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 ; Isn't *after* a major GC *before* the next one ? The major GC being incremental, the major collection is almost always already started, your code running between two slices of the same major collection. So, it looks like this alarm is catching the only time between the last slice of a major collection and the first slice of the next one. --Fabrice