[ This is a long email and there's no smoking gun at the end, yet.  If
you're not in the mood for a cliffhanger, I'm sorry. ]


To try and chase down this memory leak, I did some very basic tests.
The first is to eliminate all application code issues by starting a
vanilla AOLserver 4.0.10a (tip of aolserver_v40_bp branch) and using the
sample-config.tcl.  The only change I made to the sample-config.tcl is
to uncomment the nscp section so I could connect to my test nsd through
nscp.

For reference, my machine is:

    $ uname -a
    Linux ecwav 2.6.7 #5 Thu Jul 22 02:43:13 EDT 2004 i686 GNU/Linux

    $ getconf GNU_LIBPTHREAD_VERSION
    NPTL 0.60

    $ dpkg -l | grep libc6
    ii  libc6          2.3.2.ds1-18   GNU C Library: Shared libraries and 
Timezone

    $ LD_LIBRARY_PATH=lib bin/nsd -V
    AOLserver/4.0.10a (aolserver4_0)
       CVS Tag:         $Name:  $
       Built:           Jan 14 2005 at 12:40:17
       Tcl version:     8.4
       Platform:        linux

    $ tclsh
    % info patchlevel
    8.4.7

The first test case is to send a bad HTTP request which gets handled in
the driver thread without creating new threads (as the connection just
gets closed).

    # Memory footprint of nsd before test.
    $ ps -Ao pid,vsz,rss,comm | egrep "PID|2414"
      PID   VSZ  RSS COMMAND
     2414 13912 2840 nsd

    # Throw 100K bad requests at the server.
    $ i=0; while [ $i -lt 100000 ]; do (echo "GET"; echo "") | nc $hostname 
8000; i=`expr $i + 1`; done

    # Memory footprint of nsd after test.
    $ ps -Ao pid,vsz,rss,comm | egrep "PID|2414"
      PID   VSZ  RSS COMMAND
     2414 13912 2840 nsd

No change.  So, looks like the driver thread and the conn I/O stuff
isn't leaking.

Lets test a basic request which results in a 404 page.  Since this is a
vanilla server, the pageroot is empty, so any request will result in a
404.

    # Memory footprint of nsd before test.
    $ ps -Ao pid,vsz,rss,comm | egrep "PID|20257"
      PID   VSZ  RSS COMMAND
    20257 13912 2824 nsd

    # Throw 5000 valid requests at the server.
    $ ab -c 50 -n 5000 http://$hostname:8000/
    This is ApacheBench, Version 1.3d <$Revision: 1.67 $> apache-1.3
    ...
    Concurrency Level:      50
    Time taken for tests:   30.873 seconds
    Complete requests:      5000
    Failed requests:        0
    Broken pipe errors:     0
    Non-2xx responses:      5000
    Total transferred:      3610000 bytes
    HTML transferred:       2740000 bytes
    Requests per second:    161.95 [#/sec] (mean)
    Time per request:       308.73 [ms] (mean)
    Time per request:       6.17 [ms] (mean, across all concurrent
    requests)
    Transfer rate:          116.93 [Kbytes/sec] received
    ...

    # Memory footprint of nsd after test.
    $ ps -Ao pid,vsz,rss,comm | egrep "PID|20257"
      PID   VSZ  RSS COMMAND
    20257 173200 158580 nsd

Wow.  It grew from 13.9MB to 173.2MB in 5000 requests.  That's a growth of
159.3MB or 31.8K (lets say 32K) per request.  Lets see if Valgrind will
show us where we're losing memory.

    $ LD_LIBRARY_PATH=lib valgrind bin/nsd -ft test-config.tcl -u www -g www -d
    ==25493== Memcheck, a memory error detector for x86-linux.
    ==25493== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al.
    ==25493== Using valgrind-2.2.0, a program supervision framework for 
x86-linux.
    ...
    [14/Jan/2005:12:46:25][25493.5][-driver-] Notice: driver: accepting 
connections

At this point, I run the same ApacheBench against the server as I did
above.  Then, I send a Ctrl-C to valgrind, and ...

    ==25493== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 45 from 1)
    ==25493== malloc/free: in use at exit: 30030551 bytes in 6876 blocks.
    ==25493== malloc/free: 31940 allocs, 25064 frees, 40621246 bytes allocated.
    ==25493== For a detailed leak analysis,  rerun with: --leak-check=yes
    ==25493== For counts of detected errors, rerun with: -v

Oops.  Forgot to run it with all the bells and whistles.  Lets try
again:

    $ LD_LIBRARY_PATH=lib valgrind --leak-check=yes --show-reachable=yes 
--num-callers=8 bin/nsd -ft test-config.tcl -u www -g www -d
    ...
    ==17911==
    ==17911== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 45 from 1)
    ==17911== malloc/free: in use at exit: 29279847 bytes in 6825 blocks.
    ==17911== malloc/free: 31864 allocs, 25039 frees, 39860882 bytes allocated.
    ==17911== For counts of detected errors, rerun with: -v
    ==17911== searching for pointers to 6825 not-freed blocks.
    ==17911== checked 13556740 bytes.
    ==17911==
    ==17911== 8 bytes in 1 blocks are still reachable in loss record 1 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BB9334C: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 24 bytes in 2 blocks are still reachable in loss record 2 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BB93B72: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 32 bytes in 2 blocks are still reachable in loss record 3 of 32
    ==17911==    at 0x1B907901: calloc (vg_replace_malloc.c:176)
    ==17911==    by 0x1BA30495: (within /lib/tls/libdl-2.3.2.so)
    ==17911==    by 0x1BA3FE3E: (within /usr/lib/valgrind/libpthread.so)
    ==17911==
    ==17911==
    ==17911== 40 bytes in 2 blocks are still reachable in loss record 4 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1B8EEDAA: _dl_map_object_deps (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB4035: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1B8EFF25: _dl_catch_error (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB3DC9: _dl_open (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BBB5C40: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BBB5ABB: __libc_dlopen_mode (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BB505E5: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 42 bytes in 3 blocks are still reachable in loss record 5 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BB2076A: strdup (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x53492E52: ???
    ==17911==
    ==17911==
    ==17911== 48 bytes in 4 blocks are still reachable in loss record 6 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BB3CB23: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 56 bytes in 7 blocks are still reachable in loss record 7 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BB9305D: __nss_lookup_function (in 
/lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BB505E5: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1B96497B: (within /home/aolserver/4.0.10/lib/libnsd.so)
    ==17911==
    ==17911==
    ==17911== 60 bytes in 1 blocks are still reachable in loss record 8 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BAC7DFB: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BAC7019: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BAC66DC: setlocale (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BA12564: TclpSetInitialEncodings (in 
/usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9C58E1: (within /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9C3982: Tcl_FindExecutable (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B93285F: Ns_Main (nsmain.c:430)
    ==17911==
    ==17911==
    ==17911== 88 bytes in 1 blocks are still reachable in loss record 9 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BBB4850: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 101 bytes in 4 blocks are still reachable in loss record 10 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1B8EA7BE: _dl_map_object (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB3F8E: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1B8EFF25: _dl_catch_error (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB3DC9: _dl_open (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BBB5C40: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BBB5ABB: __libc_dlopen_mode (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BB505E5: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 108 bytes in 3 blocks are still reachable in loss record 11 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1B8EA4FB: _dl_map_object (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB3F8E: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1B8EFF25: _dl_catch_error (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB3DC9: _dl_open (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BA2FFD6: (within /lib/tls/libdl-2.3.2.so)
    ==17911==    by 0x1BA30455: (within /lib/tls/libdl-2.3.2.so)
    ==17911==    by 0x101: ???
    ==17911==
    ==17911==
    ==17911== 112 bytes in 7 blocks are still reachable in loss record 12 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BB80CEB: tsearch (in /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 154 bytes in 10 blocks are still reachable in loss record 13 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BB93A81: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 176 bytes in 1 blocks are still reachable in loss record 14 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BAC6DC6: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 209 bytes in 7 blocks are still reachable in loss record 15 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1B8ED14E: (within /lib/ld-2.3.2.so)
    ==17911==    by 0x1B8E8C9B: (within /lib/ld-2.3.2.so)
    ==17911==    by 0x1B8EA4B5: _dl_map_object (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB3F8E: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1B8EFF25: _dl_catch_error (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB3DC9: _dl_open (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BBB5C40: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 272 bytes in 4 blocks are possibly lost in loss record 16 of 32
    ==17911==    at 0x1B907901: calloc (vg_replace_malloc.c:176)
    ==17911==    by 0x1B8F25A8: (within /lib/ld-2.3.2.so)
    ==17911==    by 0x1B8F265F: (within /lib/ld-2.3.2.so)
    ==17911==    by 0x1B8F2887: _dl_allocate_tls (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BA38C59: pthread_create (vg_libpthread.c:1174)
    ==17911==    by 0x1BA13000: TclpThreadCreate (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1BA13999: Tcl_InitNotifier (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9EFA64: TclInitNotifier (in /usr/lib/libtcl8.4.so.0)
    ==17911==
    ==17911==
    ==17911== 356 bytes in 5 blocks are still reachable in loss record 17 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1B8EEE9A: _dl_map_object_deps (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB4035: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1B8EFF25: _dl_catch_error (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB3DC9: _dl_open (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BBB5C40: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BBB5ABB: __libc_dlopen_mode (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BB505E5: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 364 bytes in 13 blocks are still reachable in loss record 18 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BA13752: TclpNewAllocMutex (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1BA0009E: (within /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1BA002B2: TclpAlloc (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9A5E04: Tcl_Alloc (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B96AFAE: ns_malloc (memory.c:67)
    ==17911==    by 0x1B96B5BD: Ns_CsInit (cslock.c:86)
    ==17911==    by 0x1B96AEDB: NsInitMaster (master.c:63)
    ==17911==
    ==17911==
    ==17911== 593 bytes in 16 blocks are still reachable in loss record 19 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BB93504: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 848 bytes in 7 blocks are still reachable in loss record 21 of 32
    ==17911==    at 0x1B907901: calloc (vg_replace_malloc.c:176)
    ==17911==    by 0x1B8F1232: _dl_check_map_versions (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB453F: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1B8EFF25: _dl_catch_error (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB3DC9: _dl_open (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BBB5C40: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BBB5ABB: __libc_dlopen_mode (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BB505E5: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 1024 bytes in 1 blocks are still reachable in loss record 22 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BB50C5E: getgrnam (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1B9324EA: Ns_Main (nsmain.c:293)
    ==17911==    by 0x80486BB: main (main.c:64)
    ==17911==
    ==17911==
    ==17911== 1024 bytes in 1 blocks are still reachable in loss record 23 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BB51F9E: getpwnam (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1B932498: Ns_Main (nsmain.c:276)
    ==17911==    by 0x80486BB: main (main.c:64)
    ==17911==
    ==17911==
    ==17911== 1224 bytes in 1 blocks are still reachable in loss record 24 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BB3DED2: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BB3CCC8: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BB3D7C8: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x71D0A: ???
    ==17911==
    ==17911==
    ==17911== 1712 bytes in 12 blocks are still reachable in loss record 25 of 
32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BAC75EA: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 4121 bytes in 7 blocks are still reachable in loss record 26 of 32
    ==17911==    at 0x1B907901: calloc (vg_replace_malloc.c:176)
    ==17911==    by 0x1B8ECF33: (within /lib/ld-2.3.2.so)
    ==17911==    by 0x1B8E8C9B: (within /lib/ld-2.3.2.so)
    ==17911==    by 0x1B8EA4B5: _dl_map_object (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB3F8E: (within /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1B8EFF25: _dl_catch_error (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BBB3DC9: _dl_open (in /lib/tls/libc-2.3.2.so)
    ==17911==    by 0x1BBB5C40: (within /lib/tls/libc-2.3.2.so)
    ==17911==
    ==17911==
    ==17911== 4736 bytes in 4 blocks are possibly lost in loss record 27 of 32
    ==17911==    at 0x1B907AD5: memalign (vg_replace_malloc.c:217)
    ==17911==    by 0x1B8F2631: (within /lib/ld-2.3.2.so)
    ==17911==    by 0x1B8F2887: _dl_allocate_tls (in /lib/ld-2.3.2.so)
    ==17911==    by 0x1BA38C59: pthread_create (vg_libpthread.c:1174)
    ==17911==    by 0x1BA13000: TclpThreadCreate (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1BA13999: Tcl_InitNotifier (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9EFA64: TclInitNotifier (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9C6CE8: TclInitSubsystems (in /usr/lib/libtcl8.4.so.0)
    ==17911==
    ==17911==
    ==17911== 19200 bytes in 1 blocks are still reachable in loss record 28 of 
32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BA005A0: TclThreadAllocObj (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9F09A8: Tcl_NewObj (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1BA11E1F: TclpInitLibraryPath (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9C58CB: (within /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9C3982: Tcl_FindExecutable (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B93285F: Ns_Main (nsmain.c:430)
    ==17911==    by 0x80486BB: main (main.c:64)
    ==17911==
    ==17911==
    ==17911== 129567 bytes in 2 blocks are possibly lost in loss record 29 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BA0029C: TclpAlloc (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9A5E04: Tcl_Alloc (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B96AFAE: ns_malloc (memory.c:67)
    ==17911==    by 0x1B96B004: ns_calloc (memory.c:85)
    ==17911==    by 0x1B93B325: CreatePool (server.c:584)
    ==17911==    by 0x1B93B0F6: NsInitServer (server.c:514)
    ==17911==    by 0x1B932B1A: Ns_Main (nsmain.c:583)
    ==17911==
    ==17911==
    ==17911== 1123596 bytes in 69 blocks are possibly lost in loss record 30 of 
32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BA00C50: (within /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1BA00286: TclpAlloc (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9A5E04: Tcl_Alloc (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B96AFAE: ns_malloc (memory.c:67)
    ==17911==    by 0x1B96B5BD: Ns_CsInit (cslock.c:86)
    ==17911==    by 0x1B96AEDB: NsInitMaster (master.c:63)
    ==17911==    by 0x1B96BDED: NsInitThreads (thread.c:106)
    ==17911==
    ==17911==
    ==17911== 1641640 bytes in 5005 blocks are still reachable in loss record 
31 of 32
    ==17911==    at 0x1B907901: calloc (vg_replace_malloc.c:176)
    ==17911==    by 0x1BA00016: (within /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1BA002B2: TclpAlloc (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9A5E04: Tcl_Alloc (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B96AFAE: ns_malloc (memory.c:67)
    ==17911==    by 0x1B96B5BD: Ns_CsInit (cslock.c:86)
    ==17911==    by 0x1B96AEDB: NsInitMaster (master.c:63)
    ==17911==    by 0x1B96BDED: NsInitThreads (thread.c:106)
    ==17911==
    ==17911==
    ==17911== 26347512 bytes in 1618 blocks are still reachable in loss record 
32 of 32
    ==17911==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==17911==    by 0x1BA00C50: (within /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1BA00286: TclpAlloc (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9A5E04: Tcl_Alloc (in /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9D97A7: (within /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9DC3AF: (within /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9DB823: (within /usr/lib/libtcl8.4.so.0)
    ==17911==    by 0x1B9E43A2: Tcl_FSEvalFile (in /usr/lib/libtcl8.4.so.0)
    ==17911==
    ==17911== LEAK SUMMARY:
    ==17911==    definitely lost: 0 bytes in 0 blocks.
    ==17911==    possibly lost:   1258171 bytes in 79 blocks.
    ==17911==    still reachable: 28020876 bytes in 6742 blocks.
    ==17911==         suppressed: 800 bytes in 4 blocks.


Woah!  What's that 26MB of memory inside of Tcl_FSEvalFile?  I'm
re-running Valgrind with --num-callers=32 to get more detail:

    ==24398== 26217240 bytes in 1610 blocks are still reachable in loss record 
32 of 32
    ==24398==    at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
    ==24398==    by 0x1BA00C50: (within /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1BA00286: TclpAlloc (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9A5E04: Tcl_Alloc (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9D97A7: (within /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9DC3AF: (within /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9DB823: (within /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9E43A2: Tcl_FSEvalFile (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9AF2EE: Tcl_SourceObjCmd (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9A1613: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9A1993: Tcl_EvalObjv (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9A282C: Tcl_EvalObjEx (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9FA079: Tcl_UplevelObjCmd (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9A1613: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9C85DD: (within /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9C7BBA: TclCompEvalObj (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9FA756: TclObjInterpProc (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9A1613: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9A21C3: Tcl_EvalEx (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9A264A: Tcl_Eval (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1BA12E57: Tcl_Init (in /usr/lib/libtcl8.4.so.0)
    ==24398==    by 0x1B9437E3: InitInterp (tclinit.c:1134)
    ==24398==    by 0x1B9429AA: Ns_TclInit (tclinit.c:264)
    ==24398==    by 0x1B9429F4: Ns_TclCreateInterp (tclinit.c:313)
    ==24398==    by 0x1B923B06: NsConfigEval (config.c:436)
    ==24398==    by 0x1B932892: Ns_Main (nsmain.c:432)
    ==24398==    by 0x80486BB: main (main.c:64)
    ==24398==
    ==24398== LEAK SUMMARY:
    ==24398==    definitely lost: 0 bytes in 0 blocks.
    ==24398==    possibly lost:   1290739 bytes in 81 blocks.
    ==24398==    still reachable: 27890276 bytes in 6733 blocks.
    ==24398==         suppressed: 800 bytes in 4 blocks.

Oh, wow.  Something at server start-up allocates 26MB of memory and
doesn't let it go?  What's that all about.  Still, doesn't explain the
32K/request leakage we're seeing, though.

The good news is at least Valgrind thinks that there are no definitely
lost blocks.  However, it's also doesn't show us where/how that 150MB of
memory is being used because it allows AOLserver to gracefully shut down
before it does its memory leak check.  I really need to figure out how
to get Valgrind to do a leak check while the application is still
running and has all the memory allocated, etc.  That'd be really useful.

-- Dossy

--
Dossy Shiobara                       mail: [EMAIL PROTECTED]
Panoptic Computer Network             web: http://www.panoptic.com/
  "He realized the fastest way to change is to laugh at your own
    folly -- then you can let go and quickly move on." (p. 70)


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to