Free IRAM_8BIT

Alberk
Posts: 55
Joined: Sat Jun 19, 2021 1:49 am

Free IRAM_8BIT

Postby Alberk » Wed Oct 20, 2021 9:23 am

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)

burakss
Posts: 3
Joined: Fri Mar 11, 2022 8:01 am

Re: Free IRAM_8BIT

Postby burakss » Wed Mar 30, 2022 8:48 am

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?

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: Free IRAM_8BIT

Postby ESP_Sprite » Thu Mar 31, 2022 1:57 am

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.

Who is online

Users browsing this forum: Tanio_LLLLLL and 75 guests