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
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.