You're already doing all the right things - looking at the objects with Devel::Peek, storing a blessed IV, etc. Nice work. This is similar to a module I maintain, Set::Object.
I think all that's happening is that at global destruction time, structures aren't cleaned up in the normal way. After all, you still want destructors for objects in circular references to be called. Instead Perl just calls destructors for all objects, and it wouldn't surprise me if it did that without dropping refcnt values first.
Perhaps try changing your test program to trigger the objects falling out of scope before the end of the program is reached.
I also remember having to use the sv2mortal range of macros, perhaps have a look at those too if the above doesn't help.
$h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/." ."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";
In reply to Re: XS: Manipulating refcounts
by mugwumpjism
in thread XS: Manipulating refcounts
by creamygoodness
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |