Perl Monk, Perl Meditation | |
PerlMonks |
Re^3: Managing C library memory in XSby dmitri (Priest) |
on May 05, 2014 at 12:51 UTC ( [id://1085060]=note: print w/replies, xml ) | Need Help?? |
Are you suggesting to make perl code explicitly call the wrapper (instead of relying on DESTROY) and keeping a separate (non perl) refcount for every person pointer in the module? Call the wrapper from DESTROY. The library you are using knows about the references and counts, so you should be able to figure out in your XS code whether to really free an object (person, in this case). In Perl code (DESTROY), simply call your XS function, which will know what to do.
In Section
Seekers of Perl Wisdom
|
|