Version française
Home     About     Download     Resources     Contact us    
Browse thread
Causes for segfaults
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Norman Hardy <norm@c...>
Subject: Re: [Caml-list] Causes for segfaults

On 2010 Nov 15, at 10:50 , Daniel de Rauglaudre wrote:

> On Mon, Nov 15, 2010 at 07:38:25PM +0100, Jamie Brandon wrote:
> 
>> jamie@jamie-aspire:~$ cat > segfault.ml
>> let rec ints n = n :: ints (n+1)
>> let _ = ints 0
>> jamie@jamie-aspire:~$ ocamlopt segfault.ml
>> jamie@jamie-aspire:~$ ./a.out
>> Segmentation fault
> 
> Stack overflow in native code triggers a segmentation fault, indeed.
> I think in C, it is the same thing. Not tested in the OCaml runtime
> for efficiency purposes, I think.
> 
> --

My 2 cents worth of ideas for efficient and safe stack frame allocation:
http://cap-lore.com/code/BigStack.html

On Mac:
172% uname -a
Darwin apple-s-Computer.local 10.5.0 Darwin Kernel Version 10.5.0: Fri Nov  5 23:20:39 PDT 2010; root:xnu-1504.9.17~1/RELEASE_I386 i386
172% ocaml -version
The Objective Caml toplevel, version 3.12.0
172% cat > segfault.ml
let rec ints n = n :: ints (n+1)
let _ = ints 0
172% ocamlopt segfault.ml
ld: in /usr/local/lib/ocaml/std_exit.o, indirect symbol index out of range
collect2: ld returned 1 exit status
File "caml_startup", line 1, characters 0-1:
Error: Error during linking