Version française
Home     About     Download     Resources     Contact us    
Browse thread
Segfault using malloc within stubs
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: julius <flute@n...>
Subject: Segfault using malloc within stubs
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