Page 1 of 1

Heap Summary - Corrupted

Posted: Tue Nov 22, 2022 12:53 pm
by donalm
Hey folks,
I'm getting the following sporadic error in my software:

Code: Select all

Heap summary for capabilities 0x0000080C:
  At 0x3fcb1d44 len 4095 free 7 allocated 1588 min_free 7
    largest_free_block 0 alloc_blocks 21 free_blocks 0 total_blocks 21
  At 0x3fcabe50 len 213424 free 4 allocated 201120 min_free 4
    largest_free_block 0 alloc_blocks 2471 free_blocks 0 total_blocks 2471
  At 0x3fce0000 len 60980 free 4 allocated 58116 min_free 4
    largest_free_block 0 alloc_blocks 111 free_blocks 0 total_blocks 111
  Totals:
    free 15 allocated 260824 min_free 15 largest_free_block 0

Backtrace:0x4037A4AA:0x3FCB9A700x4037E605:0x3FCB9A90 0x4003EC95:0x3FCB9AB0  |<-CORRUPTED
Any thoughts on what exactly this is and what steps I should take to resolving it?
Thank you,
Donal

Re: Heap Summary - Corrupted

Posted: Tue Nov 22, 2022 1:14 pm
by filo_gr
Are you using malloc()/calloc() calls?

If yes, are you checking if the result of the pointer is not NULL?
Also, be sure you free() the dynamic memory you don't use

Re: Heap Summary - Corrupted

Posted: Wed Nov 23, 2022 5:59 pm
by chegewara

Code: Select all

free 15 allocated 260824 min_free 15 largest_free_block 0
totally no free memory.

Re: Heap Summary - Corrupted

Posted: Thu Nov 24, 2022 8:22 pm
by mbratch
If you at least want to try to find out what function the heap ran out (which is not necessarily the function causing the problem), you can run the following command on your heap dump:

C:\Users\whoever-you-are\.espressif\tools\xtensa-esp32-elf\esp-2021r2-patch3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-addr2line.exe -fe 0x4037A4AA:0x3FCB9A70 0x4037E605:0x3FCB9A90 0x4003EC95:0x3FCB9AB0

Of course, choose the path details for your specific ESP-IDF installation.