httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <...@engelschall.com>
Subject Re: Malloc v.s. pools (was Shared memory in APR.)
Date Fri, 16 Jul 1999 09:34:07 GMT

In article <87u2r6m712.fsf@pobox.com> you wrote:
> "Ralf S. Engelschall" <rse@engelschall.com> writes:
>> 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
> ...
>> Opinions?
> 
> Pools have better performance that malloc not on the alloc,
> but on the free.  Better code size too.  They have nicer semantics 
> too since they resolve lossage in malloc's minimalist solution to 
> the cleanup problem.
> 
> All memory management schemes have attributes...
>   1. What heap do they embed within.
>   2. Whats the story around Alloc/Free on that boundry.
>   3. Whats the story around Alloc/Free on their API.
>   4. How do they deal with the gc or fragmentation problem.
>   5. What introspection services are available.
>   6. What cleanup hooks are provided.
> [...]

Err.... yes, of course. I fully agree with you that pools have nice semantics
and that inside Apache the pool stuff is IMHO actually the most clever thing
at all. No doubt, a pool facility is essential for server applications.

But that was not my concern: I focused on the performance issue only, Ben.
People always say that when a server uses malloc() it slows it down while
using a wrapper which does the malloc() in larger chunks wouldn't slow it
down. And although all your points are valid and shared by me, they do not say
anything about the performance. You only say it's better on free, but without
more details. 

So when it comes to the whole topic of "whether one needs a pool facility in a
server" we all agree, of course. But when it comes only to the topic "whether
a malloc() wrapper library is needed for performance", I'm still not convinced
that the statement "malloc() is slow and has to be increased for performance
reasons by using a wrapper which allocates in larger chunks" is true.  Because
as I said, with a reasonable malloc library doing a ``cp = malloc(<expected
maximum memory consumption>); free(cp);'' at server startup should lead to
mostly the same as using a wrapper library because the heap cannot shrink on
Unix and unless the chunk handling is totally bogus in the malloc library it
should be mostly equal. I guess I overlook something essential here, of
course. So my question is: WHAT?
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Mime
View raw message