Some loose thoughts - don't remember which I've mentioned before: Have you looked at the Hoard <http://www.hoard.org> and ptmalloc <http://www.malloc.de/en/> allocators? Ganesan R mentioned those in openldap-devel thread "Thread-local malloc discussion summary", Apr 2003, but there were no replies: http://www.openldap.org/lists/openldap-devel/200304/msg00044.html
Are there still loops that build arrays of values by reallocing one more element (usually a pointer) in the array for each iteration? Change things using pointer-to-array-of-values to use a struct { pointer to array, #allocated items, #used items }. In some cases, I imagine you could use variable-length arrays if the compiler supports them. (Outside of any loops in function bodies, since I've seen mention of implementations that use alloca() for them. That does not free the memory until the function returns.) Use macro which declare an array where available (C99, gcc, whatever), or malloc/free it otherwise. -- Hallvard