ESP32 vs ESP32S3 Free Heap and RAM #10528
-
Hi everyone. I have compiled ulab with micropython (https://github.com/v923z/micropython-ulab) according to instructions on that repo to two micro-controllers: ESP32-S3-WROOM-1 and ESP32-WROOM-32E. When I was compiling I used GENERIC_S3 for ESP32-S3 and GENERIC for ESP32 as "board" variable.
Results I get are as follows: For ESP32-S3-WROOM-1: for ESP32-WROOM-32E: What puzzles me is that according to respective documentations ESP32-S3 has 512 KB SRAM (https://www.espressif.com/sites/default/files/documentation/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf) while ESP32 has 520 KB SRAM (https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32e_esp32-wroom-32ue_datasheet_en.pdf). How come I am getting bigger heap on S3? My expectation was that I will have more memory on ESP32 that on ESP32-S3. Am I misunderstanding something about how memory is allocated with Micropython? Did I do a mistake when I was compiling Micropython for both boards? Best Regards, Pavel. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@pavelgolikov The micropython heap is does not take up the full SRAM because we need to leave some behind for the Espressif IDF (e.g. for the WiFi and BLE stacks, as well as things like SSL and socket buffers). There's some history here... The summary of the heuristic we use is that we ask the IDF for the largest contiguous free region, and then use half of that. So what you're seeing here is that due to memory usage by the IDF leading to fragmentation, the size of the largest contiguous region is different. |
Beta Was this translation helpful? Give feedback.
@pavelgolikov The micropython heap is does not take up the full SRAM because we need to leave some behind for the Espressif IDF (e.g. for the WiFi and BLE stacks, as well as things like SSL and socket buffers). There's some history here...
The summary of the heuristic we use is that we ask the IDF for the largest contiguous free region, and then use half of that.
So what you're seeing here is that due to memory usage by the IDF leading to fragmentation, the size of the largest contiguous region is different.