Page 1 of 1

Free IRAM_8BIT

Posted: Wed Oct 20, 2021 9:23 am
by Alberk
Hi,
The result MALLOC_CAP_IRAM_8BIT is always zero, is it correct?

Code: Select all

size_t freeiram = heap_caps_get_free_size(MALLOC_CAP_IRAM_8BIT)

Re: Free IRAM_8BIT

Posted: Wed Mar 30, 2022 8:48 am
by burakss
Hi,
I get the same result but my application works correctly. I assume we can't print the free memory size in IRAM (something like MALLOC_CAP_IRAM_32BIT) from the application.
Also, I observe zero bytes by calling heap_caps_get_free_size() with MALLOC_CAP_INVALID, MALLOC_CAP_RTCRAM, MALLOC_CAP_RETENTION.
Is there any comment on this?

Re: Free IRAM_8BIT

Posted: Thu Mar 31, 2022 1:57 am
by ESP_Sprite
IRAM is normally only accessable in 32-bit increments. There's a hack you can turn on (but it only works in single-core mode and makes memory access pretty slow) to store 8-bit aligned data in IRAM; enabling that would show a non-zero value there.

I don't think there's a way to figure out how much 'pure' IRAM is available (as some memory is capable of being both IRAM as well as DRAM), but if all you want to know is if you can store more program code in IRAM, the capabilities MALLOC_CAP_EXEC|MALLOC_CAP_INTERNAL should tell you that.