On Mon, Sep 25, 2000, Andres Kroonmaa wrote:
> On 25 Sep 2000, at 17:52, Adrian Chadd <adrian@creative.net.au> wrote:
> 
> > 
> > This patch is a little rough but it converts a couple of "should have been
> > MemPool'ed a long time ago" structures. 
> > 
> > Can I get someone to look at this and tell me if its right? If so, I'll
> > commit it.
> > 
> 
>  I wanted to ask few clarifications. 
> 
>  1. Why do we need to always clear alloced memory?
>    memPool seems to only use calloc to actually get memory. When it gets
>    memory from pools, it doesn't clear it, instead it clears mem always
>    during free. Seems weird, although no difference.
Squid assumes that a newly-allocated "thing" is zeroed. Its bitten me
a few time. :)
>    memset adds some overhead, even if very small, it adds up (especially
>    on systems with limited CPU-ram bandwidth, like Intel). Do we actually
>    need to clear the membuffers? Maybe there would be reason to split
>    memPoolAlloc into separate versions: memPoolMalloc and memPoolCalloc?
Most of the time you'd be zeroing it anyway unless you were reading in some
socket buffer data.
>  2. memPool does not try to align allocations at any size. calloc() does
>    it at small sizes (8). Maybe we should add a check that when allocations
>    of VM page size granularity occurs, we should use valloc() or memalign()
>    As Henrik has noted, this could speedup OS->userspace disk buffering by
>    reducing mem-mem copying. Also, if we tune dlmalloc.c to use mmaps for
>    allocations > 4-16KB, we could eventually somewhat reduce memory
>    fragmentation also.
> 
FreeBSD's malloc does page-align requests over a certain size. Feel free to 
try optimising the memPool stuff. :-)
Remember that the MemPool code is very basic and there's a lot of room for
improvement.
Adrian
-- Adrian Chadd "If a butterfly flaps its wings in China, <adrian@creative.net.au> will a women get naked in Amsterdam?" -- Ashley Penney on Chaos TheoryReceived on Mon Sep 25 2000 - 04:57:37 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:38 MST