Keep creating new perl interpreter and freeing it always causes me leaking.
The way I used is that creating perl interpreter once, save it and use it
next time.

-----Original Message-----
From: Radu Greab [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 3:26 PM
To: [EMAIL PROTECTED]
Subject: Re: Embedded memory problem [perl #22121]


"Widgery, Tom" wrote:
> This seems to cause a rather large memory leak - I have traced through
this
> line by line and can see that the perl_parse obtains a large amount of
> memory but the perl_free doesn't seem to release any of it.
> 
> My question is:  Is there anyway to fix this issue? Unfortunately if we
> can't find a way to release this memory I am going to have to re-write
> everything using another language!!!

Please try your code with a perl configured with -Dusemultiplicity.
Teoretically you should have few or no leaks.

If you can't configure and use perl with -Dusemultiplicity, then check
perlembed(1) and perlhack(1) for the meaning of PL_perl_destruct_level
interpreter variable and PERL_DESTRUCT_LEVEL environment variable. The
example from perlembed.pod should be:

 while(1) {
     ...
     /* reset global variables here with PL_perl_destruct_level = 1 */
     PL_perl_destruct_level = 1;
     perl_construct(my_perl);
     ...
     /* clean and reset _everything_ during perl_destruct */
     PL_perl_destruct_level = 1;
     perl_destruct(my_perl);
     perl_free(my_perl);
     ...
     /* let's go do it again! */
 }


-- 
Radu Greab

Reply via email to