max contiguous memory allocation on ESP32 ?
Posted: Wed Jun 28, 2023 8:25 pm
Hi,
I would like to allocate a large buffer of 150KB on the ESP32 (without using the SPIRAM). I had a look at the documentation and it seems like it should be possible to allocate up to 160Kb in DRAM however I do cannot find out how to do that (from Arduino IDE).
I tried static allocation via:
but this fails with the linker complaining that its overflowing the "dram0_0_seg" region.
I also tried to malloc the memory on the heap with
but this also fails (with malloc returning a null pointer).
I am experimenting on an otherwise empty .ino script to minimize external memory fragmentation (no Wifi library or anything else that may use memory in the background). I am using Arduino 2.1 IDE and I tried building the script for several different ESP32 profiles: "ESP32 Dev Module" , "ESP32 Wrover module" ... but it always fails.
Doesn't the ESP32 memory map contain a contiguous 150Kb of RAM available ? Note that when compiling for a ESP32-S3 module instead, I have no problem fitting the 150K buffer in memory.
Thanks in advance for any help/pointers on how to increase the maximum amount of contiguous memory that can be allocated on ESP32 (without using the SPIRAM).
I would like to allocate a large buffer of 150KB on the ESP32 (without using the SPIRAM). I had a look at the documentation and it seems like it should be possible to allocate up to 160Kb in DRAM however I do cannot find out how to do that (from Arduino IDE).
I tried static allocation via:
Code: Select all
static uint8_t buffer[1024*150]
I also tried to malloc the memory on the heap with
Code: Select all
uint8_t * buffer = malloc(1024*150);
I am experimenting on an otherwise empty .ino script to minimize external memory fragmentation (no Wifi library or anything else that may use memory in the background). I am using Arduino 2.1 IDE and I tried building the script for several different ESP32 profiles: "ESP32 Dev Module" , "ESP32 Wrover module" ... but it always fails.
Doesn't the ESP32 memory map contain a contiguous 150Kb of RAM available ? Note that when compiling for a ESP32-S3 module instead, I have no problem fitting the 150K buffer in memory.
Thanks in advance for any help/pointers on how to increase the maximum amount of contiguous memory that can be allocated on ESP32 (without using the SPIRAM).