in reply to Re^3: Managing C library memory in XS
in thread Managing C library memory in XS
Yes... I that seems like an workable solution which ensures that any memory owning object is not freed before all references to contained objects are gone.
It's a bit hard to maintain code wise though... isn't it? I mean... every perl method using an XS method must know which objects to keep a reference to. ... and that requires knowledge about how the XS code is implemented
It basically does the same as I suggested with the NV field: Increment the refcnt on the record object and store a back-reference to it so it can be decremented with the person object has DETROY called. Only difference is doing that on the Perl side.
I don't think doing it on the XS side like I proposed with abusing the NV field is difficult. Actually it's a lot less code. The question is how large a red light it lights up :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Managing C library memory in XS
by Corion (Patriarch) on May 05, 2014 at 13:56 UTC |