summaryrefslogtreecommitdiff
path: root/firmware/include/buflib.h
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-01-28 06:58:09 +0100
committerThomas Martitz <kugel@rockbox.org>2014-02-02 19:40:38 +0100
commit4ce39f7e73b1d1ca4ac5c906d9f9593f46872133 (patch)
tree4f6c5c5b6839e9b4ba08600e72459fe6b788a862 /firmware/include/buflib.h
parent4ce1deacfd4e5440cc82237ebc5fafbaeea64763 (diff)
downloadrockbox-4ce39f7e73b1d1ca4ac5c906d9f9593f46872133.tar.gz
rockbox-4ce39f7e73b1d1ca4ac5c906d9f9593f46872133.zip
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
Diffstat (limited to 'firmware/include/buflib.h')
-rw-r--r--firmware/include/buflib.h11
1 files changed, 11 insertions, 0 deletions
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
@@ -54,6 +54,17 @@ struct buflib_context
54}; 54};
55 55
56/** 56/**
57 * This declares the minimal overhead that is required per alloc. These
58 * are bytes that are allocated from the context's pool in addition
59 * to the actually requested number of bytes.
60 *
61 * The total number of bytes consumed by an allocation is
62 * BUFLIB_ALLOC_OVERHEAD + requested bytes + strlen(<name passed to
63 * buflib_alloc_ex()) + pad to pointer size
64 */
65#define BUFLIB_ALLOC_OVERHEAD (6*sizeof(union buflib_data))
66
67/**
57 * Callbacks used by the buflib to inform allocation that compaction 68 * Callbacks used by the buflib to inform allocation that compaction
58 * is happening (before data is moved) 69 * is happening (before data is moved)
59 * 70 *