From: Howard Chu Date: Sat, 14 Nov 2009 23:25:14 +0000 (+0000) Subject: Add a note about sl_malloc stack-based behavior X-Git-Tag: ACLCHECK_0~122 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1eebd221513c2c1d79610d55744ae8b78756c038;p=openldap Add a note about sl_malloc stack-based behavior --- diff --git a/servers/slapd/sl_malloc.c b/servers/slapd/sl_malloc.c index 660c59842d..ad4c1d6e7a 100644 --- a/servers/slapd/sl_malloc.c +++ b/servers/slapd/sl_malloc.c @@ -90,6 +90,14 @@ slap_sl_mem_init() static struct slab_heap *slheap; #endif +/* This allocator always returns memory aligned on a 2-int boundary. + * + * The stack-based allocator stores the size as a ber_len_t at both + * the head and tail of the allocated block. When freeing a block, the + * tail length is ORed with 1 to mark it as free. Freed space can only + * be reclaimed from the tail forward. If the tail block is never freed, + * nothing else will be reclaimed until the slab is reset... + */ void * slap_sl_mem_create( ber_len_t size,