mm/mm_heap: output memory info about each task
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
0fddf71b2d
commit
8a1e985e71
@ -31,6 +31,7 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/mm/mm.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
#include "mm_heap/mm.h"
|
||||
#include "kasan/kasan.h"
|
||||
@ -82,6 +83,18 @@ static void mm_free_delaylist(FAR struct mm_heap_s *heap)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MM_BACKTRACE
|
||||
void mm_dump_handler(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
{
|
||||
struct mallinfo_task info;
|
||||
|
||||
info.pid = tcb->pid;
|
||||
mm_mallinfo_task(arg, &info);
|
||||
mwarn("pid:%5d, used:%10d, nused:%10d\n",
|
||||
tcb->pid, info.uordblks, info.aordblks);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -254,7 +267,9 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
|
||||
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);
|
||||
# ifdef CONFIG_MM_BACKTRACE
|
||||
nxsched_foreach(mm_dump_handler, heap);
|
||||
# endif
|
||||
#endif
|
||||
#ifdef CONFIG_MM_PANIC_ON_FAILURE
|
||||
PANIC();
|
||||
|
Loading…
Reference in New Issue
Block a user