From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id D0988BBBB for ; Mon, 13 Mar 2006 16:13:15 +0100 (CET) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.202]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k2DFDEkg005626 for ; Mon, 13 Mar 2006 16:13:15 +0100 Received: by xproxy.gmail.com with SMTP id i27so813831wxd for ; Mon, 13 Mar 2006 07:13:14 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=PQTcNMQBwDuVQW6wV+GZXG0kOA5i0FFZIevmym7f5qBYnGL8LwB/rFTiQQXYYC9zfF28CCsrO1gsVq44vwNxPoah/2A7l/UH0Ntwze01lRVmC9qqXAUJD2N24eYnvXo5t3wAlSBoe3ChM8PhnmA/qKby+TSrBiAXhKqQ8O048VU= Received: by 10.70.46.7 with SMTP id t7mr2480728wxt; Mon, 13 Mar 2006 07:13:14 -0800 (PST) Received: by 10.70.57.14 with HTTP; Mon, 13 Mar 2006 07:13:14 -0800 (PST) Message-ID: Date: Mon, 13 Mar 2006 10:13:14 -0500 From: "Markus Mottl" To: "=?ISO-8859-1?Q?Sayan_(S=E9bastien_Li-Thiao-T=E9)?=" Subject: Re: [Caml-list] Allocating caml lists from C : possible bug on amd64 Cc: caml-list@yquem.inria.fr In-Reply-To: <44158770.6000407@crans.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2921_13557996.1142262794363" References: <440F556A.9010209@crans.org> <44158770.6000407@crans.org> X-Miltered: at nez-perce with ID 44158C0B.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; markus:01 mottl:01 markus:01 mottl:01 allocating:01 bug:01 alloc:01 overwrite:01 alloc:01 ocaml:01 overwrite:01 ocaml:01 W8:98 W8:98 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=HTML_40_50,HTML_MESSAGE, INFO_TLD,RCVD_BY_IP autolearn=disabled version=3.0.3 ------=_Part_2921_13557996.1142262794363 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 3/13/06, "Sayan (S=E9bastien Li-Thiao-T=E9)" wrote: > > I am trying to learn how to allocate a list in C and pass the result to > Caml on an opteron Debian box. Here is the function that I use : Your function does not protect "str" from being reclaimed by the GC (which can happen in "caml_alloc_small"), and you should use the Field-macro only to overwrite the contents of the cons-block in this particular case, becaus= e you had used "caml_alloc_small" as allocation function, and there was no intermediate allocation. Regards, Markus -- Markus Mottl http://www.ocaml.info markus.mottl@gmail.com ------=_Part_2921_13557996.1142262794363 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 3/13/06, "Sayan (S=E9bastien Li-Thiao= -T=E9)" <sayan@crans.org= > wrote:
I am trying to learn how to allocate a list in C and pass the result to
= Caml on an opteron Debian box. Here is the function that I use :

Your function does not protect "str" from being reclaimed by the = GC (which can happen in "caml_alloc_small"), and you should use the Field-macro only to overwrite the contents of the cons-block in this particular case, because you had used "caml_alloc_small" as alloc= ation function, and there was no intermediate allocation.

Regards,
Markus

--
Markus Mottl        http://www.ocaml.info      &n= bsp; markus.mottl@gmail.com<= /a> ------=_Part_2921_13557996.1142262794363--