Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^9: perlembed: mortalize an AV or not (misc)

by tye (Sage)
on Jul 11, 2006 at 15:26 UTC ( #560492=note: print w/replies, xml ) Need Help??

in reply to Re^8: perlembed: mortalize an AV or not (misc)
in thread perlembed: mortalize an AV, get "Attempt to free unreferenced scalar" - don't mortalize, leaks memory

I'd probably only SvREFCNT_inc() if the "insert" code succeeded. That also means that you don't need to SvREFCNT_dec().

I think you'd be better off not having to remember to FREETMPS; LEAVE; if you return(), so I'd go for a simpler XS sub that lets the framework insert such stuff for you and call a regular C sub that can return() when it feels like it and the calling XS sub will do the proper clean-up.

demerphq is surely correct that this style isn't typical. But I beleive it is correct in its handling of ref counts and also understand the motivation for the style.

- tye        

  • Comment on Re^9: perlembed: mortalize an AV or not (misc)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://560492]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2018-03-24 22:40 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (299 votes). Check out past polls.