From 1eebd221513c2c1d79610d55744ae8b78756c038 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 14 Nov 2009 23:25:14 +0000 Subject: [PATCH] Add a note about sl_malloc stack-based behavior --- servers/slapd/sl_malloc.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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, -- 2.39.5