You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by mohammed samir khan <m_...@yahoo.com> on 2003/05/09 08:22:43 UTC

Help::::: Please suggest a solution for this Memory Leak issue

Hi,
              I found a memory leak in the sample code
given below. 
This is a sample of the code we are using in our
project. We are stuck with this memory leak problem.
Could you suggest some way out of this ? or Is there
any patch available for it. 
              We are using Perl 5.8.0. The platform we
are using is Linux (Redhat 8.0) and we use GNU cross
compilers(3.2.2). 
It seems as if the problem was not there in Perl
5.005_03.

-----------------------------------------------------------------------------------------------
#include<EXTERN.h>
#include<perl.h>
#include<stdio.h>

main(int argc,char** argv,char** env)
{

PerlInterpreter *my_perl;
unsigned int count;

count = 0;

            while (count != 1000)
            {
                    my_perl = perl_alloc();
                    perl_construct(my_perl);
                    PL_exit_flags |=
PERL_EXIT_DESTRUCT_END;
                   
perl_parse(my_perl,NULL,argc,argv,(char**)NULL);
                    perl_run(my_perl);
                    perl_destruct(my_perl);
                    perl_free(my_perl);
                    count++;
                    printf("count = %d\n",count);
             }

}


----------------------------------------------------------------------------------------------

The command used for compiling is :::: g++ -g ex2.c
`perl -MExtUtils::Embed -e ccopts -e ldopts`
-UHAS_BOOL -Ubool -DCRLDEBUG -DCRLVERBOSE -o PerlLeak


-------------------------------------------------------------------------------------------------

sample run:::

<<CommandPrompt>>PerlLeak
Print("sfskffjskf\n");
CTRL+D
sfskffjskf
count = 1
Print("sfskffjskf\n");
CTRL+D
sfskffjskf
count = 2
Print("sfskffjskf\n");
CTRL+D
sfskffjskf
count = 3

thanks in advance..
Samir



__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org