This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 0e7833951cb1fdf10233e7a8193999aa054483f8 Author: huojianchao <[email protected]> AuthorDate: Mon Nov 24 22:01:54 2025 +0800 mm/mempool: add the header size to MEMPOOL_DEFINE pool sizes mempool_init() takes ninitial = (initialsize - MEMPOOL_HEADER_SIZE) / blocksize, and expands only when expandsize >= blocksize + header. MEMPOOL_DEFINE() set both sizes without the header, so a static pool got one block less than prealloc and never expanded by dynalloc blocks. Signed-off-by: huojianchao <[email protected]> --- include/nuttx/mm/mempool.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nuttx/mm/mempool.h b/include/nuttx/mm/mempool.h index d4ae0029f30..fbf3ba6aabb 100644 --- a/include/nuttx/mm/mempool.h +++ b/include/nuttx/mm/mempool.h @@ -69,10 +69,10 @@ static struct mempool_s name = \ { \ CONCATENATE(name, _buffer), \ - MEMPOOL_REALBLOCKSIZE(blksize) * (prealloc), \ + MEMPOOL_REALBLOCKSIZE(blksize) * (prealloc) + MEMPOOL_HEADER_SIZE, \ (blksize), \ 0, \ - MEMPOOL_REALBLOCKSIZE(blksize) * (dynalloc), \ + MEMPOOL_REALBLOCKSIZE(blksize) * (dynalloc) + MEMPOOL_HEADER_SIZE, \ (maxalloc), \ true, \ NULL, \
