in reply to Re: [XS] How to detect the TEMP flag
in thread [XS] How to detect the TEMP flag

I found that if you ensure that subroutine return values are explicitly set sv_2mortal(), many of the traps "went away", but I fear that I may have been creating SVs that would never get cleaned up?

I think that's the main difference. I'm creating persistent objects that ought to be cleaned up - but only when they go out of scope. I don't think I can make use of 'sv_2mortal' for this particular exercise. (I could be wrong about that ... I'll have to give it some more thought.)

Hopefully, my reply to ikegami's reply makes things a little clearer. (My original post suffers from having been written 10 minutes too early. I hate it when that happens.)
I do know that if I don't bless the object into any package, then everything works fine. The only problems then are that:
1) we'll get memory leaks if:
    a) the user doesn't manually call the clean-up function;
    b) the Rmpc_realref return value is not assigned to a variable;
2) the Rmpc_realref return value can't be used with the overloaded Math::MPFR operators.

Cheers,
Rob