Re: CONFIG_HEAP_MEM_POOL_SIZE


Andy Ross
 

I thought I fixed the docs, but it looks like that text is in kconfig?

The original mem_pool code had a hard requirement that the memory region be a power of four larger than the smallest allocation unit.  That was relaxed a while back so that odd sizes would work, though at the cost of some fragmentation.  And now the whole mem_pool implementation has been replaced as the default by a newer heap that has more conventional behavior and is more flexible with memory regions and more fragmentation resistant.  You have to ask (via kconfig) to get the old backend now, the same API is pointing to wrappers.

So yes: pretty much any size will work fine for default code in the current tree.  There are a few dragons still though, like the fact that CONFIG_HEAP_MEM_POOL_SIZE is actually padded significantly before it becomes a byte array in your image (because it specifies what in the old scheme was the block of "live" memory, and the old mem_pool would then allocate a completely separate array for metadata that wasn't accounted for).

Andy

On 6/9/2020 12:34 AM, Armand C. wrote:

Hello,

I'm using Zephyr 2.2.0 and I would like to configure a heap size greater than 16kB but the documentation for CONFIG_HEAP_MEM_POOL_SIZE says that Supported values are: 256, 1024, 4096, and 16384. If I configure a higher value (e.g. 102400) it works but I'm afraid of possible side-effect.

Does someone know if it is safe to use other values than the one documented?

Regards,

Armand C.

Join users@lists.zephyrproject.org to automatically receive all group messages.