Version française
Home     About     Download     Resources     Contact us    
Browse thread
Segfault in Garbage collector code: any ideas?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Raj Bandyopadhyay <rajb@r...>
Subject: Segfault in Garbage collector code: any ideas?
Dear all

I am running a large OCaml application with a C interface, and I get  
a segfault for larger inputs. Since it seemed to be occurring in  
OCaml's garbage collector code, I  recompiled OCaml  with a '-g'  
option  and  used gdb to track  the  source of the segfault. Here's  
what I see in gdb:

<
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0075a000

caml_oldify_mopup () at minor_gc.c:201
201             Field (new_v, i) = f;

(gdb) bt
#0  caml_oldify_mopup () at minor_gc.c:201
#1  0x0011dd14 in caml_empty_minor_heap () at minor_gc.c:221
#2  0x0011de80 in caml_minor_collection () at minor_gc.c:260
#3  0x00122908 in caml_interprete (prog=0x168f0c, prog_size=7708608)  
at interp.c:538
#4  0x001171e8 in caml_callbackN_exn (closure=7602900, narg=1,  
args=0x71d004) at callback.c:82
#5  0x0011723c in caml_callback_exn (closure=7602900, arg1=7708608)  
at callback.c:109
... functions  from  my C code


1) From past  experience, this  sort  of  thing seems  to  occur when  
I forget to use a CAMLparam/local/return  macro somewhere. However, I  
have looked over my C code several times and can't find any such  
problem. Is there any other scenario where this sort of segfault can  
occur?

2) Can those macros be misused, somehow? I have used them in every  
function which is passed or returns or creates a 'value'.

Any suggestions on how I'd go about finding the source of this  
problem would be welcome.

I apologize in advance for lack of specific information about the  
application, I'm not sure what information would be useful. Please  
feel free to email me with any questions or suggestions.

Thank you
Raj