in reply to Re^8: semi-panic: attempt to dup freed string?
in thread semi-panic: attempt to dup freed string?

By receiver, I meant the Perl interpreter calling get.

The code (o->sv = newSV(0);) is in new since new is called in the same Perl interpreter as get.

My DESTROY doesn't do anything useful, but it needs to free the memory new allocated.

Replies are listed 'Best First'.
Re^10: semi-panic: attempt to dup freed string?
by BrowserUk (Patriarch) on Mar 26, 2011 at 00:07 UTC

    This doesn't detract from the fact that what you've given me works! But I'm still trying to tie down exactly why it works.

    The code (o->sv = newSV(0);) is in new since new is called in the same Perl interpreter as get.

    I'm calling get() in two threads, but new() only in one?


    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.

      It's not really in terms of gets and sets. The point is that the SV must be created in a thread that's still around when the SV is last used.

        Okay, that makes more sense.

        It represents a design limitation; that you should create these things in your primary thread, and pass them to spawned threads, rather than have spawned threads pass them back, but that is typical usage anyway, so I can live with it. At least for now.


        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.