httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: cvs commit: apache-1.3/src/modules/standard mod_log_referer.c
Date Fri, 22 May 1998 18:00:52 GMT
Brian Behlendorf wrote:
> 
> At 06:11 PM 5/21/98 +0100, you wrote:
> >brian@hyperreal.org wrote:
> >>   -        ap_str_tolower(referer);
> >>   +        referertest = ap_pstrdup(orig->pool, referer);
> >>   +        ap_str_tolower(referertest);
> >
> >Where these things are for local use only, wouldn't it be better (i.e.
> >more efficient) to use alloca?
> >
> >       referertest=alloca(strlen(referer)+1);
> >       strcpy(referertest,referer);
> >       ap_str_tolower(refertest);
> 
> I thought since our pool mechanisms asks the OS for memory in specific
> sized chunks (4K?) and hands that out in chunks as needed, that it's better
> to deal with this allocation in userland than in the kernel (less chance of
> using a 4K page for 80 bytes of characters, etc?)

Err? Surely alloca only hits the kernel if you have to grow the stack as
a result? And, of course, it gives the memory back much sooner than
pstrdup does.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|  Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author    http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Mime
View raw message