From: "Mladen Turk" <[EMAIL PROTECTED]>
Sent: Thursday, August 09, 2001 5:18 AM

> Will Wrote;
> >
> > I will also hook in apr.lib (static, not dynamic) for
> > nothing more than table and pool create/destruct...
> >  Pools should make this app very memory-lite, since each iteratation can gain a
> > sub pool that is then destroyed cleanly (without the leaking resources).
> > Using a table or hash to track the installed/running services
> > (when there are many) will also be a nice improvement.
> 
> I disagree with that, if you only wish to use the apr for maintaining a
> service list. It a only a simple list so why using hash tables or something
> like that (brute force will beat any hash table for small number of items).
> I've created a static struct with 3 char pointers and a DWORD times 128 (for
> a reasonable number of services). I agree that when you are using only a 3
> services you have a overhead of 7296 bytes of static memory, but do you
> think that introducing apr would fit into that memory frame?
> Other thing is if you want to use the dynamic memory allocation for cases
> when there are more than 128(?????) services installed on one box, but still
> why using apr for that? Its only a simple linked list after all.

Then you don't follow the transactional power of pools :-)  Yes, the base list
(not a terribly huge structure) needs to stay in memory.  It even requires 256
byte buffers (gasp!) for each service identifier.  But that's not what worries
me much...

The actual querying should happen, not on heap (slow, hefty) but apr_palloc'ed
buffers.  When the enumeration is done (and after each enumerated service) we
dump the pool back into avail.  It should prove to be very lightweight, much
as httpd itself is :)

> >   TARGET:  500kb working set, or less!  Possible?  Don't know yet.
> 
> Simple WinMain eats around 300K.
> I'm also very sceptic about Task manager (if that's what are you using for a
> mem usage). For Example the previous program (winapi.c) in the attachment,
> report 848K of memory when compiled with VC and 856 with BCC. First time
> when the program is minimized it reports the 92K/100K of mem usage, and when
> restored again aroun 270K. (Very strange). Next time you minimize the window
> it reports 88/96K of mem usage.

I'll share your skepticizm, but that is more likely the resource consumption and
garbage collection that is sometimes less than optimal.  Plus, I'm not surprized,
startup code pages waste some space for a while, and should later be gc'ed out.


> I offer a patch that has a removed About box and tests the ImagePath
> Registry key for \apache, .exe, and --ntservice or -k runsevice. This gives
> you an option to have for an example a apachexxxxxxxxx.exe as a exe name.

I'll take it even a step further, and suggest httpd* would also be nice.  Maybe
something configurable?  Dunno.

Bill

Reply via email to