From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p35Cr2PF030516 for ; Tue, 5 Apr 2011 14:53:02 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhkHABIQm01QW+UMgWdsb2JhbACYYI0JFAEBFiYlwxmFawSMA4EihxE X-IronPort-AV: E=Sophos;i="4.63,304,1299452400"; d="scan'208";a="80239573" Received: from lo.gmane.org ([80.91.229.12]) by mail3-smtp-sop.national.inria.fr with ESMTP; 05 Apr 2011 14:52:57 +0200 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q75kd-0003Oc-LT for caml-list@inria.fr; Tue, 05 Apr 2011 14:52:55 +0200 Received: from avelizy-155-1-44-71.w83-204.abo.wanadoo.fr ([83.204.203.71]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Apr 2011 14:52:55 +0200 Received: from sylvain by avelizy-155-1-44-71.w83-204.abo.wanadoo.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Apr 2011 14:52:55 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Sylvain Le Gall Date: Tue, 5 Apr 2011 12:52:41 +0000 (UTC) Message-ID: References: X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: avelizy-155-1-44-71.w83-204.abo.wanadoo.fr User-Agent: slrn/pre1.0.0-18 (Linux) Subject: [Caml-list] Re: C bindings and Gc.compact Hello, On 05-04-2011, Pedro Borges wrote: > Hi, everyone, > > If a compactification is triggered do the values get rewritten or do > they become invalid? > > If the value have been allocated outside the Gc (e.g. malloc-ed), the pointer is still valid. If it is an OCaml value, it will get rewritten. But this is already the case with the other Gc stage, and the reason why you should use CAMLparam/CAMLreturn. Cheers, Sylvain Le Gall -- My company: http://www.ocamlcore.com Linkedin: http://fr.linkedin.com/in/sylvainlegall Start an OCaml project here: http://forge.ocamlcore.org OCaml blogs: http://planet.ocamlcore.org