heap: clean up some size related issues
First, the maximum heap size must fit in 31 bits worth of chunks because the internal 32-bit field holding the size is shared with the `used` bit. Then the mention of a 256-byte block in the doc is no longer relevant. That pertained to the previous allocator implementation. And ditto for the HEAP_MEM_POOL_MIN_SIZE kconfig option. Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
parent
4b46aa7a95
commit
7a22a4bdf6
3 changed files with 4 additions and 17 deletions
|
@ -351,8 +351,8 @@ void *sys_heap_realloc(struct sys_heap *heap, void *ptr, size_t bytes)
|
|||
|
||||
void sys_heap_init(struct sys_heap *heap, void *mem, size_t bytes)
|
||||
{
|
||||
/* Must fit in a 32 bit count of HUNK_UNIT */
|
||||
__ASSERT(bytes / CHUNK_UNIT <= 0xffffffffU, "heap size is too big");
|
||||
/* Must fit in a 31 bit count of HUNK_UNIT */
|
||||
__ASSERT(bytes / CHUNK_UNIT <= 0x7fffffffU, "heap size is too big");
|
||||
|
||||
/* Reserve the final marker chunk's header */
|
||||
__ASSERT(bytes > heap_footer_bytes(bytes), "heap size is too small");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue