[Gc] Segmentation fault when embedding GC in Matlab (fwd)

Boehm, Hans hans.boehm at hp.com
Wed Aug 22 15:10:25 PDT 2007


It seems that GC_scratch_alloc (called by GC_init_headers) is returning
null or a bogus pointer.  GC_scratch_alloc usually gets its memory from
either sbrk (default on your platform, I think) or mmap (or it tries
both in gc7).  It would be good to know what it's returning; I haven't
seen this before.

Hopefully Matlab only invokes ECL from the main thread, not another JVM
thread?  And cross-heap pointers are not an issue?

This does sound like a tricky combination to get right, but I don't know
immediately why it should fail here.

Hans

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Boehm, Hans
> Sent: Friday, August 17, 2007 9:58 AM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] Segmentation fault when embedding GC in Matlab (fwd)
> 
> Forwarding, since it's a bit hard for me to approve it at the 
> moment ...
> 
> ---------- Forwarded message ----------
> Date: Fri, 17 Aug 2007 15:43:00 +0200
> From: Goffioul Michael <goffioul at imec.be>
> To: gc at linux.hpl.hp.com
> Subject: Segmentation fault when embedding GC in Matlab
> 
> Hello,
> 
> I'm working on project where I try to embed ECL (Common Lisp 
> implementation based on GC, see http://ecls.sourceforge.net) 
> into a MEX file in Matlab.
> I've done it under Windows and everything runs fine. Now I 
> try to port it to Linux, but I get a segmentation fault at GC 
> initialization.
> 
> First my setup:
> AMD Opteron 250, running Linux Redhat 32-bits Matlab 7.3
> gcc-3.4.5 compiled for 32-bits platforms ECL CVS (compiled 
> for 32 bits, without thread support)
>    -> this version uses GC-6.8
> 
> When I start Matlab without JVM support, I can load my MEX 
> file without any problem. If I start it with JVM support, 
> then GC initialization segfaults with the following backtrace:
> 
> #0  0x004a6c77 in memset () from /lib/tls/libc.so.6
> #1  0xbfff8990 in ?? ()
> #2  0x02de7869 in GC_init_headers () at
> /imec/other/miracad/src/ecl-cvs/src/gc/headers.c:142
> #3  0x02decad5 in GC_init_inner () at
> /imec/other/miracad/src/ecl-cvs/src/gc/misc.c:724
> #4  0x02dec7d7 in GC_init () at
> /imec/other/miracad/src/ecl-cvs/src/gc/misc.c:497
> #5  0x02dc01bf in init_alloc () at
> /imec/other/miracad/src/ecl-cvs/src/c/alloc_2.d:171
> #6  0x02ce56bd in cl_boot (argc=1, argv=0xbfff8100) at
> /imec/other/miracad/src/ecl-cvs/src/c/main.d:189
> #7  0x00a03a2d in mexFunction (nlhs=0, plhs=0xbfff8990, nrhs=1,
> prhs=0xbfff89f0) at test.cpp:36
> #8  0x00a7009d in mexRunMexFile () from
> /imec/software/matlab/7.3/bin/glnx86/libmex.so
> [snip]
> 
> Would you have any idea about what's going on? Thanks.
> 
> Michael.
> 
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> 



More information about the Gc mailing list