httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <...@engelschall.com>
Subject Re: Shared memory in APR. (fwd)
Date Thu, 15 Jul 1999 07:09:58 GMT

In article <Pine.LNX.4.04.9907140700140.8969-100000@chosondo.raleigh.ibm.com> you wrote:

> [...] 
> malloc/free are not cheap
> functions to use.  
> [...] 

Sorry for the off-topic question: This statement occurs from time to time and
I was never convinced of its truth - at least not under Unix. Sure, AFAIK
malloc() is expensive the first time when it has to do the sbrk() calls.  But
under Unix you never can shrink the heap. So subsequent malloc()s after
free()s are cheap IMHO, because they just fetch the chunks from
the pool of free chunks. And when you've a reasonable malloc library, IMHO one
can get mostly the same runtime results with malloc() as one will get for
Apache's chunk-based memory handling _ONCE_ you've done a ``cp =
malloc(<expected memory consumption>); free(cp)'' at startup time.  Or I'm
missing some important point here? 

My concern in short: people say it's better to use an own allocator which
allocates in larger chunks.  And I think the same can be achieved by just
moving a large chunk of the heap into the initial malloc()'s list of free
chunks.

Opinions?
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Mime
View raw message