mm: Add CONFIG_MM_PANIC_ON_FAILURE option

While allocation failure here is not necessarily abnormal enough to
warrant a panic in general, it can be useful in certain situations.
This commit is contained in:
YAMAMOTO Takashi 2022-05-21 08:13:09 +09:00 committed by Xiang Xiao
parent b05320cac2
commit 5edf5e5585
2 changed files with 8 additions and 0 deletions

View File

@ -201,4 +201,9 @@ config MM_DUMP_ON_FAILURE
default n
depends on DEBUG_MM
config MM_PANIC_ON_FAILURE
bool "Panic on allocation failure"
default n
depends on DEBUG_MM
source "mm/iob/Kconfig"

View File

@ -255,6 +255,9 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
minfo.arena, minfo.uordblks, minfo.fordblks,
minfo.mxordblk, minfo.aordblks, minfo.ordblks);
mm_memdump(heap, -1);
#endif
#ifdef CONFIG_MM_PANIC_ON_FAILURE
PANIC();
#endif
}
#endif