Yeah ..... bummer !!
I'm building against a pre-compiled GD library I got from somewhere. It's recent, but I don't know what version it is and couldn't find a quick way of determining the version. GD-2.30 builds cleanly against it for me (using MinGW compiler) and the tests run fine - except for one warning:

"t/Polyline....Subroutine scale redefined at D:\comp58_M\GD-2.30\blib\lib/GD/Polyline.pm line 52."

The error in your test script arises when 'my $raw = $gd->gd;' is called. That calls the XS function gdgd(), which can produce the "Free to wrong pool..." error on subsequent iterations.
At first I thought it might be the gdFree() that gdgd() calls, but the fault occurs after that - ie, I guess, when gdgd() exits/returns. There's not a lot of code in gdgd() so I fiddled about with it for quite some time but couldn't get anywhere .... which means I'm about stumped. I did get some mileage from allocating with New() ... but success seemed to depend upon the strategic placement of debug printf() statements ... which is not a good sign :-)

Cheers,
Rob

In reply to Re^7: Segfault on second (identical) call to a sub by syphilis
in thread Segfault on second (identical) call to a sub by BrowserUk

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.