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 A3599BC75 for ; Fri, 25 Feb 2005 01:37:26 +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 j1P0bDpR010710 for ; Fri, 25 Feb 2005 01:37:26 +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 BAA29461 for ; Fri, 25 Feb 2005 01:37:12 +0100 (MET) Received: from NetworkPhysics.COM (fw.networkphysics.com [205.158.104.176]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j1P0bBr7003475 for ; Fri, 25 Feb 2005 01:37:12 +0100 Received: from networkphysics.com (stratus.fractal.networkphysics.com [10.10.1.104]) by NetworkPhysics.COM (8.12.10/8.12.10) with ESMTP id j1P0bAT1026062 for ; Thu, 24 Feb 2005 16:37:10 -0800 (PST) (envelope-from garry@networkphysics.com) Message-ID: <421E730B.7000501@networkphysics.com> Date: Thu, 24 Feb 2005 16:36:27 -0800 From: Garry Belka User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.4.2) Gecko/20040301 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] Segfault using malloc within stubs Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 421E7337.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 segfault:01 malloc:01 stubs:01 run-time:01 allocating:01 ocaml:01 ocaml:01 segfault:01 notation:01 -unsafe:01 stub:01 compile:01 functions:01 interaction:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: In our case the problem was in an interaction of interface definition and run-time system, so to say. The memory we were allocating within stub was described as an Ocaml string, and so Ocaml was trying to check its size at first access, and failing with segfault. As soon as we defined access functions for the string based on unsafe_get instead of naively using x.(i) notation, we stopped seeing Segfault. Other option it to compile code with -unsafe turned on. Garry