Re: more xcalloc() -> mempool conversions!

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Mon, 25 Sep 2000 21:32:47 +0200

Andres Kroonmaa wrote:

> 1. Why do we need to always clear alloced memory?

Yes. Almost all parts of the code assumes all structure fields are
initialized to zero, and only fills in the fields needed.

Also, the clearing on free is a protection mechanism to make it likelier
that references after free are trapped.

> 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()

Quite limited application (only disk I/O), and for that part we can
quite likely make a special allocation model instead of cluttering the
generic pool construct with this.

> Also, if we tune dlmalloc.c to use mmaps for allocations >
> 4-16KB, we could eventually somewhat reduce memory fragmentation
> also.

dlmalloc already does that for requests larger than mmap_threshold
(default 128K). I doubt it will be a good idea to do it for small
allocations (<64KB) due to the overhead of setting up/tearing down
mmap..

Also on some architectures (Ultra sparc for example) the page size is
16KB.

/Henrik
Received on Mon Sep 25 2000 - 14:06:58 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:38 MST