[Gc] Segmentation fault when embedding GC in Matlab (fwd)
goffioul at imec.be
Thu Aug 23 01:22:31 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.
I tracked down the problem a little bit further, with gdb.
GC is using sbrk on my platform, around line 1639 in os_dep.c
result = (ptr_t)sbrk((SBRK_ARG_T)bytes);
This call returns a correct address when matlab is started without
the JVM, and -1 (0xFFFFFFFF) when matlab is started with the JVM.
> Hopefully Matlab only invokes ECL from the main thread, not
> another JVM thread? And cross-heap pointers are not an issue?
[don't know what you mean with cross-heap pointers]
Regarding JVM threads, my code doesn't do anything special with threads.
I have a normal MEX file that I call from Matlab prompt. This MEX file
begins with calling cl_boot (from ECL), which in turn initialize GC.
More information about the Gc