Thanks anonymonk. That allowed me to track down this (which I apparently missed first time?):

SV * Perl_newSVsv(pTHX_ register SV *const old) { dVAR; register SV *sv; if (!old) return NULL; if (SvTYPE(old) == SVTYPEMASK) { Perl_ck_warner_d(aTHX_ packWARN(WARN_INTERNAL), "semi-panic: attem +pt to dup freed string"); return NULL; } new_SV(sv); /* SV_GMAGIC is the default for sv_setv() SV_NOSTEAL prevents TEMP buffers being, well, stolen, and saves + games with SvTEMP_off and SvTEMP_on round a call to sv_setsv. */ sv_setsv_flags(sv, old, SV_GMAGIC | SV_NOSTEAL); return sv; }

And also this:

c:\test\perl-5.13.6>findstr SVTYPEMASK *.h sv.h:#define SVTYPEMASK 0xff sv.h:#define SvTYPE(sv) ((svtype)((sv)->sv_flags & SVTYPEMASK)) sv.h:#define SvIS_FREED(sv) ((sv)->sv_flags == SVTYPEMASK)

Which tends to suggest that when an SV is freed, it's type is set to 0xff to allow duplicate frees to be detected. Though I haven't found the code where that actually happens.

Which probably means I need to implement a DESTROY method. And possible a CLONE method.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^2: semi-panic: attempt to dup freed string? by BrowserUk
in thread semi-panic: attempt to dup freed string? 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.