boehm-gc, c++ and threads

Arno J. Klaassen arno at heho.snv.jussieu.fr
Thu Aug 26 09:22:32 PDT 2004


Hello,

does someone have a clue how to get boehm-gc for a multi-threaded
C++ program?
If I compile "int main (int argc, char *argv[]){}" with

 c++ -o a.out main.cc -L/usr/local/lib -lgc -lpthread

I get the following segmentation fault :

#0  0x280b1f54 in sched_yield () from /usr/lib/libpthread.so.1
#1  0x28099093 in GC_lock () from /usr/local/lib/libgc.so.1
#2  0x2809004d in GC_malloc () from /usr/local/lib/libgc.so.1
#3  0x280900ed in malloc () from /usr/local/lib/libgc.so.1
#4  0x280b8424 in pthread_mutex_init () from /usr/lib/libpthread.so.1
#5  0x280c28af in pthread_setconcurrency () from /usr/lib/libpthread.so.1
#6  0x280c22b5 in pthread_setconcurrency () from /usr/lib/libpthread.so.1
#7  0x280b6999 in pthread_self () from /usr/lib/libpthread.so.1
#8  0x280988a1 in GC_thr_init () from /usr/local/lib/libgc.so.1
#9  0x280944a0 in GC_init_inner () from /usr/local/lib/libgc.so.1
#10 0x2808fc31 in GC_generic_malloc_inner () from /usr/local/lib/libgc.so.1
#11 0x2808fdcf in GC_generic_malloc () from /usr/local/lib/libgc.so.1
#12 0x28090075 in GC_malloc () from /usr/local/lib/libgc.so.1
#13 0x280900ed in malloc () from /usr/local/lib/libgc.so.1
#14 0x280b8424 in pthread_mutex_init () from /usr/lib/libpthread.so.1
#15 0x280c28af in pthread_setconcurrency () from /usr/lib/libpthread.so.1
#16 0x280c22b5 in pthread_setconcurrency () from /usr/lib/libpthread.so.1
#17 0x280ba814 in pthread_mutex_lock () from /usr/lib/libpthread.so.1
#18 0x28185746 in __register_frame_info_bases () from /usr/lib/libstdc++.so.4
#19 0x281857c4 in __register_frame_info () from /usr/lib/libstdc++.so.4
#20 0x28113823 in ?? () from /usr/lib/libstdc++.so.4
#21 0x2818f250 in typeinfo for std::bad_exception ()
   from /usr/lib/libstdc++.so.4
#22 0x281a4244 in ?? () from /usr/lib/libstdc++.so.4
#23 0x28072108 in ?? ()
#24 0x281bd62a in __ieee754_logf () from /lib/libm.so.2
#25 0x2810feb1 in _init () from /usr/lib/libstdc++.so.4
#26 0x2804faf9 in find_symdef () from /libexec/ld-elf.so.1
#27 0x2804e6ac in _rtld () from /libexec/ld-elf.so.1
#28 0x2804d966 in .rtld_start () from /libexec/ld-elf.so.1

I looked at the valgrind code how they got around the mallocs
during threadlib initialisation, but it is beyond my competences.
Any help appreciated.

Regards, Arno


More information about the freebsd-current mailing list