mm: Do not abort on allocation failue with CONFIG_DEBUG_MM
When allocation failed, it isn't too uncommon for the caller to fall back to other allocation method. (eg. esp32 textheap code tries iram heap when an allocation from rtc heap failed.) DEBUGASSERT(false) is too much in that case. This commit removes the DEBUGASSERT, and also makes the heap dump a separate option.
This commit is contained in:
parent
2f03b42bfc
commit
c546c0b647
@ -191,4 +191,9 @@ config MM_BACKTRACE_DEFAULT
|
||||
default n
|
||||
depends on DEBUG_MM
|
||||
|
||||
config MM_DUMP_ON_FAILURE
|
||||
bool "Dump heap info on allocation failure"
|
||||
default n
|
||||
depends on DEBUG_MM
|
||||
|
||||
source "mm/iob/Kconfig"
|
||||
|
@ -244,15 +244,18 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
|
||||
#ifdef CONFIG_DEBUG_MM
|
||||
else
|
||||
{
|
||||
#ifdef CONFIG_MM_DUMP_ON_FAILURE
|
||||
struct mallinfo minfo;
|
||||
#endif
|
||||
|
||||
mwarn("WARNING: Allocation failed, size %zu\n", alignsize);
|
||||
#ifdef CONFIG_MM_DUMP_ON_FAILURE
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user