This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 2ffca6d16dec2c976fdaa406a7c46ab816425620 Author: Jiuzhu Dong <dongjiuz...@xiaomi.com> AuthorDate: Sat Mar 26 23:27:21 2022 +0800 mm/mm_heap: output mallinfo when malloc failed Signed-off-by: Jiuzhu Dong <dongjiuz...@xiaomi.com> --- mm/mm_heap/mm_malloc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/mm_heap/mm_malloc.c b/mm/mm_heap/mm_malloc.c index 51c789d..135e1f3 100644 --- a/mm/mm_heap/mm_malloc.c +++ b/mm/mm_heap/mm_malloc.c @@ -27,6 +27,7 @@ #include <assert.h> #include <debug.h> #include <string.h> +#include <malloc.h> #include <nuttx/arch.h> #include <nuttx/mm/mm.h> @@ -243,7 +244,13 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size) #ifdef CONFIG_DEBUG_MM else { + struct mallinfo minfo; + mwarn("WARNING: Allocation failed, size %zu\n", alignsize); + mm_mallinfo(heap, &minfo); + mwarn("Total:%d, used:%d, free:%d, largest:%d, nused:%d, nfree:%d\n", + minfo.arena, minfo.uordblks, minfo.fordblks, + minfo.mxordblk, minfo.aordblks, minfo.ordblks); mm_memdump(heap, -1); DEBUGASSERT(false); }