Update: after installing a 5.8.8 built from source (Configure -d) my test programs are now running to their ends without crashing.
So I'm trying to write an XS wrapper (using Inline::C, which greatly simplifies the task) for a library that uses boehm GC -- GC_malloc and all that -- and every time I run it it segfaults in a different place. Even after disabling the garbage collection, so it's not a gc-throwing-away-memory-it-doesn't-know-about kind of problem, (unless it still is) Now I'm getting segfaults inside things that I _KNOW_ are robust, such as
gdb) where #0 0x00a3e41d in memmove () from /lib/libc.so.6 #1 0x078122c1 in Perl_sv_catpvn_flags () from /usr/lib/perl5/5.8.6/i3 +86-linux-thread-multi/CORE/libperl.so #2 0x07816196 in Perl_sv_catsv_flags () from /usr/lib/perl5/5.8.6/i38 +6-linux-thread-multi/CORE/libperl.so #3 0x0784eaf4 in Perl_do_join () from /usr/lib/perl5/5.8.6/i386-linux +-thread-multi/CORE/libperl.so #4 0x077fcaca in Perl_pp_join () from /usr/lib/perl5/5.8.6/i386-linux +-thread-multi/CORE/libperl.so #5 0x077e4b01 in Perl_runops_debug () from /usr/lib/perl5/5.8.6/i386- +linux-thread-multi/CORE/libperl.so #6 0x07792b9e in Perl_get_cv () from /usr/lib/perl5/5.8.6/i386-linux- +thread-multi/CORE/libperl.so #7 0x07797045 in Perl_call_sv () from /usr/lib/perl5/5.8.6/i386-linux +-thread-multi/CORE/libperl.so #8 0x07799517 in Perl_call_method () from /usr/lib/perl5/5.8.6/i386-l +inux-thread-multi/CORE/libperl.so #9 0x077ef199 in Perl_magic_setnkeys () from /usr/lib/perl5/5.8.6/i38 +6-linux-thread-multi/CORE/libperl.so #10 0x077ef5fc in Perl_magic_setpack () from /usr/lib/perl5/5.8.6/i386 +-linux-thread-multi/CORE/libperl.so #11 0x077ed7ee in Perl_mg_set () from /usr/lib/perl5/5.8.6/i386-linux- +thread-multi/CORE/libperl.so #12 0x077fba16 in Perl_pp_sassign () from /usr/lib/perl5/5.8.6/i386-li +nux-thread-multi/CORE/libperl.so #13 0x077e4b01 in Perl_runops_debug () from /usr/lib/perl5/5.8.6/i386- +linux-thread-multi/CORE/libperl.so #14 0x07797f51 in perl_run () from /usr/lib/perl5/5.8.6/i386-linux-thr +ead-multi/CORE/libperl.so #15 0x080493f4 in main ()
on the fourth time through a loop that worked right the first three times. Does anyone have experience with wrapping XS around a library managed with gc, who can offer some advice? Do I have to reimplement the GC interface in terms of SVPVX and make my library link against that instead of libgc? Is libgc somehow interfering with perl's malloc, or is perls malloc somehow playing fast-and-loose in such a way that GC_malloc and it are stepping on each others toes? I've got 5.8.6 -- I guess I'll build a 5.8.8 and see if that does anything for me while waiting for notification of responses.

In reply to interfacing with a boehm-gc library from XS by davidnicol

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.