Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: [XS] Cloning is corrupting my privates.

by dave_the_m (Monsignor)
on Jan 31, 2015 at 18:01 UTC ( [id://1115196]=note: print w/replies, xml ) Need Help??


in reply to [XS] Cloning is corrupting my privates. (Solved!)

Why don't you just set a watchpoint on one of the corrupted addresses and so see where and when its being changed?

Dave.

Replies are listed 'Best First'.
Re^2: [XS] Cloning is corrupting my privates.
by BrowserUk (Patriarch) on Feb 01, 2015 at 09:40 UTC

    According to perlmod:

    This provides a simple mechanism for making a module threadsafe; just add sub CLONE_SKIP { 1 } at the top of the class, and DESTROY() will now only be called once per object. Of course, if the child thread needs to make use of the objects, then a more sophisticated approach is needed.

    Are you aware of a "more sophisticated approach"?

    Ie. Is there some technique or trick to allow a module to discover which of its blessed refs have been cloned (and which not) so as to allow it to ignore/defer DESTROY requests until the last copy goes out of scope?

    Seems that if CLONE_SKIP was called each time a reference for a package it cloned -- and passed in a copy of the reference -- it would be possible for packages to do their own reference counting and thus avoid corrupting the internals of cloned objects -- by freeing memory associated with a cloned reference when one copy of it goes out of scope (when a thread ends) -- as I did.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
Re^2: [XS] Cloning is corrupting my privates.
by BrowserUk (Patriarch) on Jan 31, 2015 at 18:13 UTC

    Because that would require I had a source-level debugger that works with Perl under windows; and I don't.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
      Because that would require I had a source-level debugger that works with Perl under windows; and I don't
      You're writing XS code and can't run it under C debugger????!!!!

      Dave.

        Correct.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        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". I'm with torvalds on this
        In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1115196]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-03-28 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found