Hello, I am trying to embed perl in my C++ program. My application needs to evaluate different very simple perl programs. These perl programs will be created on the fly. So they can't be in any file on the disk. I read up perlembed and tried to execute the statements using eval_pv. This evaluation works fine. My application is a Dialog box application with MFC. The exact procedure that I am using is --
1. Create the PerlInterpreter in the constructor of the dialog box using code such as (my_perl is the PerlInterpreter) char *embedding[] = { "", "-e", "0" }; my_perl = perl_alloc(); perl_construct( my_perl ); perl_parse(my_perl, NULL, 3, embedding, NULL); PL_exit_flags |= PERL_EXIT_DESTRUCT_END; perl_run(my_perl); 2. When the user presses a button, create an appropriate perl program and put it in a string. Then use eval_pv to evaluate and get the results from it using sv* methods. strRead is the perl program string. This step can be repeated many number of times. SV *ret = eval_pv(strRead, TRUE); BOOL bSuccess = SvTRUE(ret); SvREFCNT_dec(ret); ret = Nullsv; 3. When the dialog exits, the PerlInterpreter is freed using the following code. perl_destruct(my_perl); perl_free(my_perl); The problem with this code is, after eval_pv has been called many times the application leaks some amount of memory. From perlembed I understand that this is because every time the perl parser sets up parsed code for the evaluation string and does not free them. Is there any way to clean up the data created for parsing and executing the perl program after the execution is over. The other way of doing this is to create the PerlInterpreter every time and execute the program and then free the PerlInterpreter. But this method is way too slow. Can anybody please give me some solution? Thanks in advance. Regards, Saikat -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]