ESP32 memory allocation

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

ESP32 memory allocation

Postby PeterR » Mon Aug 12, 2019 10:12 am

I have add memory diagnostocs to my application so that I may check for leaks/fragmentation.

Code: Select all

heap_caps_get_info()
and requesting capabilities:

Code: Select all

MALLOC_CAP_8BIT,   MALLOC_CAP_EXEC,   MALLOC_CAP_SPIRAM
I am suprised to see that I have MALLOC_CAP_EXEC 214,660 bytes free.
make -j8 size-components reports that the flash code size is >> 500,000.

What exactly is MALLOC_CAP_EXEC & how is it allocated to my program ?
I guess that MALLOC_CAP_EXEC is SRAM0 (192K), SRAM1(128K) but after cache I would have 256K maximum.
Why then do I have 214K MALLOC_CAP_EXEC free when my program is much larger?
& I also believe that IDF CAN should be fixed.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ESP32 memory allocation

Postby WiFive » Mon Aug 12, 2019 9:27 pm

Most of the code is not persistently loaded to IRAM, it executes "in place" through an on-demand cache

Who is online

Users browsing this forum: Google [Bot], Vineethad and 253 guests