httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Harris" <dhar...@drh.net>
Subject RE: Memory leak in 1.3.6
Date Mon, 02 Aug 1999 22:07:30 GMT

I received a request for more information about how to see this memory leak and
on what platform I'm seeing it on. I've decided to just post my debugging patch
to Apache which shows the memory leak in action with instructions on how to
actually see the leak with the patch.

First my system architecture... I'm running apache 1.3.6 on Red Hat Linux 6.0
(uname -a says Linux hobbes.drh.net 2.2.9-27mdk). I first saw the memory leak
on apache with mod_ssl, but since then I've removed mod_ssl and the leak
remains.

The patch to see the leak... I've attached it with the filename showleak.patch.
I've also attached my apache_1.3.6_newdbm.patch even though it just a fix for
the red hat 6.0 ndbm library problem, because I want you to be able to exactly
replicate my configuration.

Here are instruction on how to use the patch and see the leak:

# tar xzf apache_1.3.6.tar.gz
# cd apache_1.3.6
# patch -p1 <../showleak.patch
# patch -p1 <../apache_1.3.6_newdbm.patch # red hat 6.0 ndbm library location
fix
# ./configure \
    --prefix=/root/apache_test \
    \
    --enable-module=rewrite      --enable-module=info \
    --enable-module=unique_id    --enable-shared=unique_id \
    --enable-module=mime_magic   --enable-shared=mime_magic \
    --enable-module=speling      --enable-shared=speling \
    --enable-module=auth_anon    --enable-shared=auth_anon \
    --enable-module=digest       --enable-shared=digest \
    --enable-module=headers      --enable-shared=headers \
    --enable-module=cern_meta    --enable-shared=cern_meta \
    --enable-module=expires      --enable-shared=expires \
    --enable-module=usertrack    --enable-shared=usertrack \
    --enable-module=proxy        --enable-shared=proxy \
    --enable-module=mmap_static  --enable-shared=mmap_static
# make
# cd /root/apache_test
# vi conf/httpd.conf # changed port to 2000 from 80
# bin/httpd 2>> logs/error_log
# kill -HUP `cat logs/httpd.pid`
# kill -HUP `cat logs/httpd.pid`

Once you perform these steps the various memory usage statistics will be in the
error_log file.. and if you look at the memory usage between the
create_server_config_1 and create_server_config_2 marks, you see the leak of
memory, which is based on the growing size of total_modules. Also logged is the
value of total_modules whenever it is set, and you can see it being incremented
every time the server is restarted at the LoadModule configuration lines.

Also, note in the patch how I modified the main/alloc.c:bytes_in_block_list
function so that ap_bytes_in_pool in pool will return the number of bytes
allocated out of a pool, instead of the number of bytes used by blocks in that
pool.

 - David Harris
   Principal Engineer, DRH Internet Services



Mime
View raw message