I'm looking to share a blessed reference to any arbitrary lump of memory--the struct in this example.

Skipping the intermediate SV, ie. RV->struct rather than RV->SvUV->struct seemed like a good idea as it avoided the subject error, but it doesn't work because when the RV is cloned, Perl assumes it's value is a SV* and clones that "SV" also, which screws things completely.

Using RV->SvUV->struct recreates the original problem.

I think that I should be able to prevent the SvUV being destroyed prematurely by having it's refcount incremented by the cloning process and decremented by the DESTROY method. The problem is that the CLONE method is called as a class method, not an instance method making it impossible to take full control of the cloning method.

I don;t currently see a way around this?


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^6: 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.