I think I've found the error of my ways.

The reason that it was leaking with a static build was that the
PerlFreshRestart directive was set to 'On'.  This resulted in a
leak of a couple of Mb.

The reason that it was leaking with a USE_DSO build was that I didn't set
PERL_DESTRUCT_LEVEL.  Once I added
PerlSetEnv PERL_DESTRUCT_LEVEL 2
the leak stopped.  Actually I get the behavior Doug reported: a small leak
of around 24K on the first restart and none thereafter.

Actually in order to achieve this I had to comment out the load of
example_module.  That module leaks about 56K when restarted as a dso.

I've not been able to avoid a leak with a USE_APXS build.

-Paul



On Sun, 17 Jun 2001, Paul G. Weiss wrote:

> Now I'm really confused.  I built the whole thing statically and it still
> leaks:
> 
> the static build (using the same Perl):
> 
> ~/test/prefix/bin/perl Makefile.PL EVERYTHING=1 \
>     APACHE_PREFIX=$(echo ~/test/prefix/apache) \
>     APACHE_SRC=../apache_1.3.19 DO_HTTPD=1
> 
> Now it still leaks 520K per restart:
> 
> > make start_httpd_fork
> ../apache_1.3.19/src/httpd -f `pwd`/t/conf/httpd.conf -d `pwd`/t
> > ps -o pid,vsz,comm -p $(cat t/logs/httpd.pid )
>   PID   VSZ COMMAND
>  4877  7856 httpd
> > kill -USR1  $(cat t/logs/httpd.pid )
> > ps -o pid,vsz,comm -p $(cat t/logs/httpd.pid )
>   PID   VSZ COMMAND
>  4877  8488 httpd
> > kill -USR1  $(cat t/logs/httpd.pid )
> > ps -o pid,vsz,comm -p $(cat t/logs/httpd.pid )
>   PID   VSZ COMMAND
>  4877  9108 httpd
> 
> This is on Redhat 7.1 (not Linux 7.1 as I said below).  I didn't bother
> trying it on Solaris.
> 
> You don't suppose building with APACHE_PREFIX could have anything to do
> with it, do you?  I haven't heard of any leaks with a static build.
> 
> -P
> 
> 
> 
> 
> 
> 
> On Sun, 17 Jun 2001, Paul G. Weiss wrote:
> 
> > Doug,
> > 
> > I'm confused as to how you managed to *not* leak when I'm still
> > leaking.  I've tried these tests on both a Solaris 2.7 system and
> > a Linux 7.1.
> > 
> > Here is a summary of what I do:
> > 
> > I build Perl
> > 
> > ./Configure -des -Uusemymalloc -Dprefix=$(echo ~/test/prefix) -Dcc=gcc
> > make && make test && make install
> > 
> > I build Apache
> > 
> > ~/test/prefix/bin/perl Makefile.PL USE_DSO=1 EVERYTHING=1 \
> >     USE_APACI=1 APACHE_PREFIX=$(echo ~/test/prefix/apache) \
> >     APACHE_SRC=../apache_1.3.19 \
> >     APACI_ARGS='--enable-module=all --enable-shared=max' \
> >     DO_HTTPD=1
> > 
> > make
> > make test
> > 
> > I now run the test:
> > 
> > make start_httpd_fork
> > ps -o 'pid,vsz,comm' -p $(cat t/logs/httpd.pid )
> > kill -USR1 $(cat t/logs/httpd.pid )
> > ps -o 'pid,vsz,comm' -p $(cat t/logs/httpd.pid )
> > kill -USR1 $(cat t/logs/httpd.pid )
> > 
> > etc.  The virtual size grows each time, although by different amounts 
> > in Linux and Solaris.  Both are around 4Mb.  So what are you doing 
> > differently?  Let me know so I can do the same thing.  The Perl I'm using
> > is 5.6.1 and the modperl is
> > modperl_20010614113010.tar.gz.
> > 
> > -P
> > 
> > 
> > On Fri, 15 Jun 2001, Paul G. Weiss wrote:
> > 
> > > Don't be so willing to bet.  Still leaking.
> > > 
> > > I did as you said and just rebuilt Perl and mod_perl but didn't bother to
> > > rebuild all the Perl modules (I would have done so had I been successful
> > > here).
> > > 
> > > Here's what I see:
> > > 
> > > > make start_httpd_fork
> > > ../apache_1.3.19/src/httpd -f `pwd`/t/conf/httpd.conf -d `pwd`/t
> > > > ps -o 'pid,ppid,vsz,comm' -p $(cat t/logs/httpd.pid )
> > >   PID  PPID  VSZ COMMAND
> > > 28802     1 15528 ../apache_1.3.19/src/httpd
> > > > kill -USR1 $(cat t/logs/httpd.pid )
> > > > ps -o 'pid,ppid,vsz,comm' -p $(cat t/logs/httpd.pid )
> > >   PID  PPID  VSZ COMMAND
> > > 28802     1 20016 ../apache_1.3.19/src/httpd
> > > > kill -USR1 $(cat t/logs/httpd.pid )
> > > > ps -o 'pid,ppid,vsz,comm' -p $(cat t/logs/httpd.pid )
> > >   PID  PPID  VSZ COMMAND
> > > 28802     1 24544 ../apache_1.3.19/src/httpd
> > > > kill -USR1 $(cat t/logs/httpd.pid )
> > > > ps -o 'pid,ppid,vsz,comm' -p $(cat t/logs/httpd.pid )
> > >   PID  PPID  VSZ COMMAND
> > > 28802     1 27224 ../apache_1.3.19/src/httpd
> > > > make kill_httpd
> > > kill `cat t/logs/httpd.pid`
> > > rm -f t/logs/httpd.pid
> > > rm -f t/logs/error_log
> > > 
> > > 
> > > 
> > > On Thu, 14 Jun 2001, Doug MacEachern wrote:
> > > 
> > > > On Fri, 15 Jun 2001, Paul G. Weiss wrote:
> > > > 
> > > > >     alignbytes=8, usemymalloc=y, prototype=define
> > > >                                 ^
> > > > ok, here's why i kept asking for perl -V.  i don't see Perl's malloc.c
> > > > ever release its memory pool.  when usemymalloc=y, free() only puts memory
> > > > back into Perl's pool for use by other malloc()'s.  i don't see a function
> > > > to destroy this pool when perl cleans itself up.  willing to bet if you
> > > > rebuild Perl with: Configure -des -Uusemymalloc ...
> > > > and then rebuild mod_perl, the leaks will go away.
> > > > 
> > > 
> > 
> > 
> > 
> > 
> > 
> 
> 

Reply via email to