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 5edf5e5585fa022c0399c7b5ccf5a36476dad4c5 Author: YAMAMOTO Takashi <yamam...@midokura.com> AuthorDate: Sat May 21 08:13:09 2022 +0900 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. --- mm/Kconfig | 5 +++++ mm/mm_heap/mm_malloc.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index 30e789da5b..d49409611b 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -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" diff --git a/mm/mm_heap/mm_malloc.c b/mm/mm_heap/mm_malloc.c index a5fd14b528..1d8d6b24bc 100644 --- a/mm/mm_heap/mm_malloc.c +++ b/mm/mm_heap/mm_malloc.c @@ -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