From 4ce39f7e73b1d1ca4ac5c906d9f9593f46872133 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 28 Jan 2014 06:58:09 +0100 Subject: buflib: Add a define telling the per-alloc overhead. This allows buflib clients to more accurately estimate the total memory usage. It's still not 100% accurate because the handle table grows in blocks, thus buflib might use more memory that caused by allocations directly. Change-Id: I68338bb94f510ad188fcb588aebf895b5f9197c5 --- firmware/include/buflib.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'firmware/include') diff --git a/firmware/include/buflib.h b/firmware/include/buflib.h index e912429b1f..1bae3e7a3f 100644 --- a/firmware/include/buflib.h +++ b/firmware/include/buflib.h @@ -53,6 +53,17 @@ struct buflib_context bool compact; }; +/** + * This declares the minimal overhead that is required per alloc. These + * are bytes that are allocated from the context's pool in addition + * to the actually requested number of bytes. + * + * The total number of bytes consumed by an allocation is + * BUFLIB_ALLOC_OVERHEAD + requested bytes + strlen(