Support when malloc failed dump mempool info
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
8a124f1a6f
commit
736af90370
|
@ -474,6 +474,14 @@ void mempool_multiple_memdump(FAR struct mempool_multiple_s *mpool,
|
|||
|
||||
void mempool_multiple_deinit(FAR struct mempool_multiple_s *mpool);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mempool_multiple_info
|
||||
* Description:
|
||||
* Dump multiple memory pool's info.
|
||||
****************************************************************************/
|
||||
|
||||
void mempool_multiple_info(FAR struct mempool_multiple_s *mpool);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mempool_multiple_info_task
|
||||
* Description:
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <strings.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <nuttx/mutex.h>
|
||||
|
@ -591,6 +592,27 @@ FAR void *mempool_multiple_memalign(FAR struct mempool_multiple_s *mpool,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mempool_multiple_info
|
||||
****************************************************************************/
|
||||
|
||||
void mempool_multiple_info(FAR struct mempool_multiple_s *mpool)
|
||||
{
|
||||
struct mempoolinfo_s minfo;
|
||||
size_t i;
|
||||
|
||||
syslog(LOG_INFO, "%11s%9s%9s%9s%9s%9s%9s\n", "bsize", "total", "nused",
|
||||
"nfree", "nifree", "nwaiter", "nexpend");
|
||||
for (i = 0; i < mpool->npools; i++)
|
||||
{
|
||||
mempool_info(mpool->pools + i, &minfo);
|
||||
syslog(LOG_INFO, "%9lu%11lu%9lu%9lu%9lu%9lu%9zu\n",
|
||||
minfo.sizeblks, minfo.arena, minfo.aordblks,
|
||||
minfo.ordblks, minfo.iordblks,
|
||||
minfo.nwaiter, mpool->pools->nexpend);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mempool_multiple_info_task
|
||||
****************************************************************************/
|
||||
|
|
|
@ -268,6 +268,10 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
|
|||
# if CONFIG_MM_BACKTRACE >= 0
|
||||
nxsched_foreach(mm_dump_handler, heap);
|
||||
# endif
|
||||
# if CONFIG_MM_HEAP_MEMPOOL_THRESHOLD != 0
|
||||
mempool_multiple_info(heap->mm_mpool);
|
||||
# endif
|
||||
|
||||
#endif
|
||||
#ifdef CONFIG_MM_PANIC_ON_FAILURE
|
||||
PANIC();
|
||||
|
|
Loading…
Reference in New Issue