From: Ian Campbell Subject: Re: [PATCH v3-RESEND 12/28] libxl: ocaml: make Val_defbool GC-proof Date: Thu, 31 Oct 2013 18:15:18 +0000 Message-ID: <1383243318.5436.52.camel@dagon.hellion.org.uk> References: <1382362365-6645-1-git-send-email-rob.hoes@citrix.com> <1382362365-6645-13-git-send-email-rob.hoes@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1382362365-6645-13-git-send-email-rob.hoes@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Rob Hoes Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Mon, 2013-10-21 at 14:32 +0100, Rob Hoes wrote: > The Val_* functions potentially allocate new values on the OCaml heap, and may > trigger an iteration of the OCaml GC. Therefore, it is important to assign > values produced by Val_* immediately to variables declared with CAMLlocal > macros, which register the values with the GC. Bonkers stuff ;-) > This leads to slightly weird looking C code, but avoids hard to find segfaults. > > Signed-off-by: Rob Hoes Acked-by: Ian Campbell