SheWolf has asked for the wisdom of the Perl Monks concerning the following question:
Hi folks,
I've recently had to dive back into C to link some old C code with Perl.
My basic problem is this:char * proc_desc(a,b) char * a char b OUTPUT: RETVAL
I get the string back in Perl, but the memory for the string is never released when the receiving variable goes out of scope.
I'm trying to understand the XS world for my glue logic, but haven't had a lot of success. I've been looking into using sv_2mortal, but every string example I find allocates the string in the XS code.
So, my question is, how do I tell perl that it must deallocate the memory C handed back to it? I feel like this is such a simple, obvious thing to do.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl, C and deallocation responsibility
by etj (Priest) on Apr 26, 2023 at 23:59 UTC | |
by etj (Priest) on Apr 28, 2023 at 01:14 UTC | |
by SheWolf (Novice) on Apr 30, 2023 at 23:01 UTC | |
Re: Perl, C and deallocation responsibility
by Marshall (Canon) on Apr 29, 2023 at 06:31 UTC | |
by eyepopslikeamosquito (Archbishop) on Apr 29, 2023 at 07:20 UTC | |
by Marshall (Canon) on Apr 30, 2023 at 07:11 UTC | |
by SheWolf (Novice) on Apr 30, 2023 at 23:02 UTC | |
by etj (Priest) on May 02, 2023 at 13:38 UTC | |
by SheWolf (Novice) on May 03, 2023 at 00:38 UTC |