I have a memery leak in my XS code which I haven't been able to resolve. In a given thread, I do
this (in a simplified version):
void my_clone (void) {
PerlInterpreter *perl_interp = perl_clone(root_perl_context, CLONEf_COPY_STACKS);
PERL_SET_CONTEXT( perl_interp );
}
void my_free (void) { PerlInterpreter *current_interp = PERL_GET_CONTEXT;
perl_destruct(current_interp); perl_free(current_interp); }
int main(void) { my_clone();
/* Some action takes place */
my_free();
return 0; }
After this has been executed, I've picked up a lot of memory. Apearently, due to lack of deallocation of a perl interpreter.
What am I doing wrong? Is this the proper way of deallocating a cloned perl interpreter?
Best regards,
--Anders