in reply to Managing C library memory in XS
And the problem is that I can't see when I get a "person" pointer I get back in DESTROY whether I'm allowed to free it.
This is the key paragraph and decision point in the code. You should wrap the real free_person() in XS function that would have the logic like this:
Then from Perl just call this wrapper and let the lower-level logic worry about it.if (person_refcnt(person) == 0) free_person(person); else ; /* Do nothing: free_record() will free the person as well */
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Managing C library memory in XS
by petermogensen (Sexton) on May 05, 2014 at 12:44 UTC | |
by dmitri (Priest) on May 05, 2014 at 12:51 UTC | |
by petermogensen (Sexton) on May 05, 2014 at 12:58 UTC | |
by dmitri (Priest) on May 05, 2014 at 13:10 UTC | |
by petermogensen (Sexton) on May 05, 2014 at 13:20 UTC |