Excerpts from the mail message of Jerry Beckmann: ) ) I am having some problems with memory management with using a C library. The ) library has basically 1 function that I use. The function is foo( char* ) input, char** output). The problem is that output seems to not be freed by ) the perl xs module, and I get scripts that grow to 50+MBs very quickly. [...] ) A sample perl function that I have using it looks like:
The problem isn't the Perl subroutine but the XS subroutine. ) Any ideas on how I can free the memory that this library is allocating? Yeah, add free(output) to your XS subroutine. You don't show the XS code, but I'll bet the XS code is copying the output string (that is about all Perl will allow since Perl only deals with buffers that it has allocated itself). So you need to free the original output string after that. Tye
