Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Bauer, Christoph" <Christoph.Bauer@lms-gmbh.de>
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	[thread overview]
Message-ID: <D981925B4F2CD611870300E0184CEE9B0157F306@kaiserslautern1.lms-gmbh.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]

> 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

[-- Attachment #2: Type: text/html, Size: 3235 bytes --]

             reply	other threads:[~2004-10-15  8:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-15  8:56 Bauer, Christoph [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-10-15 15:18 Bauer, Christoph
2004-10-15 15:04 Bauer, Christoph
2004-10-14 14:59 Bauer, Christoph

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D981925B4F2CD611870300E0184CEE9B0157F306@kaiserslautern1.lms-gmbh.de \
    --to=christoph.bauer@lms-gmbh.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox