M_samir_khan <m_samir_khan@yahoo.com> writes: >Hi nick, > 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. I am busy right now, so copied to p5p and XS list for more timely comments. Either way can I/we see "perl -V" output to see build options you are using. > 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 -- Nick Ing-Simmons http://www.ni-s.u-net.com/