From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA21213; Fri, 15 Oct 2004 10:56:38 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 KAA21050 for ; Fri, 15 Oct 2004 10:56:36 +0200 (MET DST) Received: from kaiserslautern1.lms-gmbh.de (kaiserslautern1.lms-gmbh.de [212.43.68.201]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i9F8uanF010147 for ; Fri, 15 Oct 2004 10:56:36 +0200 Received: by kaiserslautern1.lms-gmbh.de with Internet Mail Service (5.5.2653.19) id ; Fri, 15 Oct 2004 10:56:35 +0200 Message-ID: From: "Bauer, Christoph" To: caml-list@inria.fr Subject: AW: [Caml-list] OCaml-3.08.1/MinGW: alloc_tuple fails Date: Fri, 15 Oct 2004 10:56:34 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C4B294.DF6E53B0" X-Miltered: at nez-perce with ID 416F90C4.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; bauer:01 bauer:01 caml-list:01 mingw:01 alloc:01 2004:99 alloc:01 val:01 val:01 for-loop:01 crashes:01 gdb:01 gdb:01 debugging:01 sigsegv:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C4B294.DF6E53B0 Content-Type: text/plain > On Thu, Oct 14, 2004 at 04:59:01PM +0200, Bauer, Christoph wrote: > > > > > > t = alloc_tuple( 100 ); > > > > for( i=0 ; i < 100; ++i ) > > > > Store_field( t, i, Int_val ( i )); > > > > > > s/Int_val/Val_int/ > > > > > > Ok, that's correct. But the problem is before the for-loop. > > It looks correct to me, but often memory corruption happens > earlier than is detected. Try adding a call to Gc.full_major > () just before you call your C function. If it crashes in > the Gc, then you've got memory corruption, and you'll need to > pepper your code with calls to Gc.full_major () to try and > narrow it down. Ok, my example program is now: (* test_it.ml *) external test : unit -> unit = "test" let _ = Gc.full_major (); test () Here is the gdb-output: $ gdb ./test_it GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-mingw32"...(no debugging symbols found)... (gdb) r Starting program: c:\bauer\ocaml-mingw\test/./test_it.exe Program received signal SIGSEGV, Segmentation fault. 0x00335e89 in ?? () (gdb) where #0 0x00335e89 in ?? () #1 0x00335f8b in ?? () #2 0x10001234 in test (_=1) at test.cpp:10 #3 0x0040155b in camlTest_it__entry () #4 0x00402915 in main () (gdb) regards, Christoph Bauer ------_=_NextPart_001_01C4B294.DF6E53B0 Content-Type: text/html AW: [Caml-list] OCaml-3.08.1/MinGW: alloc_tuple fails

> On Thu, Oct 14, 2004 at 04:59:01PM +0200, Bauer, Christoph wrote:
> >
> > >  >   t = alloc_tuple( 100 );
> > >  >   for( i=0 ; i < 100; ++i )
> > >  >     Store_field( t, i, Int_val ( i ));
> > >
> > > s/Int_val/Val_int/
> >
> >
> > Ok, that's correct. But the problem is before the for-loop.
>
> It looks correct to me, but often memory corruption happens
> earlier than is detected.  Try adding a call to Gc.full_major
> () just before you call your C function.  If it crashes in
> the Gc, then you've got memory corruption, and you'll need to
> pepper your code with calls to Gc.full_major () to try and
> narrow it down.

Ok, my example program is now:

(* test_it.ml *)
external test : unit -> unit = "test"

let _ =
  Gc.full_major ();
  test ()

Here is the gdb-output:

$ gdb ./test_it
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...(no debugging symbols found)...
(gdb) r
Starting program: c:\bauer\ocaml-mingw\test/./test_it.exe

Program received signal SIGSEGV, Segmentation fault.
0x00335e89 in ?? ()
(gdb) where
#0  0x00335e89 in ?? ()
#1  0x00335f8b in ?? ()
#2  0x10001234 in test (_=1) at test.cpp:10
#3  0x0040155b in camlTest_it__entry ()
#4  0x00402915 in main ()
(gdb)

regards,
Christoph Bauer

------_=_NextPart_001_01C4B294.DF6E53B0-- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners