🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #6799

Re: TIN - outrageous memory pig?!

#6799
From: Bruce Sterling Woodcock
Date: Sun, 05 Dec 1993 08:38
60 lines
4041 bytes
In article <1993Nov24.183058.773@htbrug.hobby.nl> herman@htbrug.hobby.nl (Herman ten Brugge) writes:
>Karl Denninger (karl@Notwerk.mcs.com) wrote:
>: What's uh the deal here?
>
>:   PID USERNAME PRI NICE   SIZE   RES STATE   TIME   WCPU    CPU COMMAND
>:  8330 roblinx    3    0  6512K  748K sleep   0:18  5.03%  5.03% tin
>:  8157 annecost   3    0  6628K 1380K sleep   0:09  3.13%  3.12% tin
>:  8395 karl      10    0  1712K 1100K sleep   0:00  0.52%  0.49% trn
>
>: THREE times the size of trn?  The text sizes are comparable -- this is all
>: dynamically allocated data!
>
>: Needless to say, this beats the hell out of the VM system on the machine!
>
>: Is there anything which can be done about this hog other than adding RAM 
>: to all the machines that run it?
>
>The reason this happens is probebly that you don't run 'updatemin' or
>'upact' to update the min fields in the active file. Tin is keeping a
>bitmap in memory for every article in the spool directory for handling
>Xref-articles. If you don't update the minimum value of the active file
>the bitmap array becomes very large and will have the above effect.

No, I've been looking into this, and the problem is definately with tin
allocating new newsgroups.  This is a BIG deal when users first start up,
and anytime after that when a new newsgroup check is done.  A good way to
see this for yourself is to remove (temporarily) your .tin/tinrc file
and start tin up again, then look at how much memory it takes.  On Netcom,
this is about 15 Megs... unacceptable, unfortunately, and thus we haven't
upgraded.  The behavior appears to be post tin-1.18, so I think I've tracked
the problem down to just this area in check_for_any_new_groups in active.c:

                /*
                 * The following code replaces the original check for new newsgroups,
                 * a source of much aggravation.
                 *
                 * The original algorithm compared each group name in active to (on
                 * average) 1/2 the groups in old_active, for ~N*N/2 string compares.
                 * This works out to ~~ 8,000,000 comparisons for 4000 newsgroups.
                 *
                 * The new algorithm allocates an array of pointers to the active
                 * and old_active array elements, sorts each pointer array with
                 * quicksort, then scans through the two arrays in 1 pass; this takes
                 * 2*N*Log2(N) string compares for the sorts, N for the final pass.
                 * This should work out to ~~ 100,000 comparisons for the same 4000
                 * newsgroups, a BIG, BIG win.
                 */

and so on.  All this allocation is apparrently not being free()d correctly
at the end of the function... or rather, it is, but struct t_notify in tin.h
allocates names as arrays, not dynamically, so this is never really getting
"free()"d.

Unfortunately, manipulating pointers with malloc() is not my strong suite...
could someone else fix this?  Iain, are you listening?

Bruce
-- 
Bruce Sterling Woodcock                 Internet:  sterling@netcom.com
Systems Support - Network Operations    Netcom Online Communication Services
Technical Details
Message-ID: <sterlingCHK00p.ABp@netcom.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!urmel.informatik.rwth-aachen.de!uni-paderborn.de!zib-berlin.de!xlink.net!howland.reston.ans.net!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!netcomsv!netcom.com!sterling
References: <2cep0n$87o@Notwerk.mcs.com> <1993Nov24.183058.773@htbrug.hobby.nl>

Show Full Headers
Complete Article Headers
Message-ID: <sterlingCHK00p.ABp@netcom.com>
Subject: Re: TIN - outrageous memory pig?!
Date: Sun, 5 Dec 1993 08:38:48 GMT
From: sterling@netcom.com (Bruce Sterling Woodcock)
References: <2cep0n$87o@Notwerk.mcs.com> <1993Nov24.183058.773@htbrug.hobby.nl>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!urmel.informatik.rwth-aachen.de!uni-paderborn.de!zib-berlin.de!xlink.net!howland.reston.ans.net!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!netcomsv!netcom.com!sterling
Newsgroups: news.software.readers
Organization: Netcom Online Communications Services (408-241-9760 login: guest)
Lines: 60