From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 67C54BC88 for ; Sun, 6 Feb 2005 08:34:02 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j167Y2TJ019356 for ; Sun, 6 Feb 2005 08:34:02 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA13389 for ; Sun, 6 Feb 2005 08:34:01 +0100 (MET) Received: from pm-mx6.mx.noos.fr (pm-mx6.mgn.net [195.46.220.208]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j167Y1mZ022951 for ; Sun, 6 Feb 2005 08:34:01 +0100 Received: from [192.168.0.2] (m101.net81-66-34.noos.fr [81.66.34.101]) by pm-mx6.mx.noos.fr (Postfix) with ESMTP id 1EBB0268CE for ; Sun, 6 Feb 2005 08:34:00 +0100 (MET) Message-ID: <4205C95E.8050404@noos.fr> Date: Sun, 06 Feb 2005 08:38:06 +0100 From: julius User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Segfault using malloc within stubs Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4205C86A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4205C869.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; segfault:01 malloc:01 stubs:01 stubs:01 wrote:01 segfault:01 camlprim:01 foo:01 camlparam:01 char:01 char:01 malloc:01 sizeof:01 camlreturn:01 ocaml:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: Hello, I have this strange problem with my stubs, I wrote this function but it leads to a segfault: CAMLprim value foo(value v) { CAMLparam1(v); CAML(result); char** test; test=(char**)malloc(4*sizeof(char*)); CAMLreturn(result); } After much tests, it seems that malloc is not allowed when using Caml data types or when trying to register data to the ocaml garbage collector... But I don't understand why as C heap and OCaml heap are distinct :-/ Thanks, Julius