Jan Wieck wrote:
>
> Right right right! Pooled allocation will gain performance
> and the separate bookkeeping should be more useful.
...
> But I can think of another thing that might help. A temporary
> allocation pool stack.
>
> The functions to manage it are:
>
> void tmppalloc_push(void);
> void tmppalloc_pop(void);
> void *tmppalloc(Size size);
> void *tmpuppalloc(Size size, int levels_up);
You might be interested in:
POOL(9) NetBSD Kernel Manual POOL(9)
NAME pool_create, pool_destroy, pool_get, pool_put, pool_prime - resource-pool manager
...
DESCRIPTION These utility routines provide management of pools of fixed-sized areas of memory. Resource pools
setaside an amount of memory for exclusive use by the resource pool owner. This can be used by applications to
guaranteethe availability of a minimum amount of memory needed to con� tinue operation independent of the memory
resourcescurrently available from the system-wide memory allocator (malloc(9)). The pool manager can optionally
obtaintemporary memory by calling the palloc() function passed to pool_create(), for extra pool items in case the
numberof allo� cations exceeds the nominal number of pool items managed by a pool re� source. This temporary
memorywill be automatically returned to the sys� tem at a later time.
...
CODE REFERENCES The pool manager is implemented in the file sys/kern/subr_pool.c.
eg. ftp://ftp.NetBSD.org/pub/NetBSD-current/src/sys/kern/subr_pool.c
Cheers,
Patrick