From 2d5d4a5749fa5e4a66e90351d34bbe792b1bbab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Wed, 16 Jan 2013 21:19:14 +0100 Subject: [PATCH] Doc notes about salloc alignment --- include/ucore/ucore_salloc.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/ucore/ucore_salloc.h b/include/ucore/ucore_salloc.h index f9a00f6..4632316 100644 --- a/include/ucore/ucore_salloc.h +++ b/include/ucore/ucore_salloc.h @@ -18,6 +18,13 @@ extern "C" { * Once a particular SAlloc has given out all memory in a chunk, a new chunk * is allocated again, using the underlying malloc(). * + * *Note* that salloc hands back densely packed memory. Allocating objects + * of different sizes from the same salloc is not recommended. e.g. + * first allocating space for a short, and then for a pointer might + * give back a pointer that is not suitable aligned. + * The first piece of memory handed back are suitable aligned for any type though, + * so allocating only pointers, or only shorts (or only a specific struct etc.) + * will give properly alignment to all objects from a SAlloc. */ /** Opaque handle to a SAlloc */