ESP32 unable to access ram

Hello,

I am using a ESP32 chip with 16 Mb of memory (I forgot the name of the chip), with a modified Esp 32 board file and partition file.

PLATFORM: Espressif 32 > Espressif ESP32 Dev Module 16 MB v2
SYSTEM: ESP32 240MHz 512KB RAM (3.19MB Flash)
Converting sim5360test.ino
Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
LDF MODES: FINDER(deep) COMPATIBILITY(soft)
Collected 20 compatible libraries
Scanning dependencies…
Dependency Graph
|-- v2.0.0
|-- v1.1
| |-- v1.0
| |-- v1.0
Compiling .pioenvs/esp32dev/src/sim5360test.ino.cpp.o
Checking size .pioenvs/esp32dev/firmware.elf
Memory Usage → Redirecting...
DATA: [= ] 10.4% (used 54312 bytes from 524288 bytes)
PROGRAM: [= ] 5.8% (used 194953 bytes from 3342336 bytes)

But when I call esp_get_free_heap_size() at the begin of the program it returns:
219876

And esp_get_free_heap_size() returns:
Heap summary for capabilities 0x00000001:
At 0x3ffe0440 len 15296 free 15248 allocated 0 min_free 15248
largest_free_block 15248 alloc_blocks 0 free_blocks 1 total_blocks 1
At 0x3ffe4350 len 113840 free 113792 allocated 0 min_free 113792
largest_free_block 113792 alloc_blocks 0 free_blocks 1 total_blocks 1
At 0x40089b24 len 91356 free 91308 allocated 0 min_free 91308
largest_free_block 91308 alloc_blocks 0 free_blocks 1 total_blocks 1
Totals:
free 220348 allocated 0 min_free 220348 largest_free_block 113792

I there believe that I am not accessing all of the 524288 bytes I allocated to the ram.
Why is this the case and what can I do to fix this?

Thank you for your time in advance.

You have 520KB RAM in total:

  • 328KB is DRAM (usable for data storage in stack or heap)
  • 192KB is IRAM (usable for instructions, i.e. function code – faster loading times than from Flash, e.g. for interrupts needed)

Since you are looking at the heap you are looking at how much DRAM the heap was assigned. That is about 215K.

The rest is used in global variables and stack for other components in the firmware, such as the RTOS, the TCP/IP stack, WiFi stack, Bluetooth, DMA buffers, et cetera.

So it’s pretty reasonable that you have ~215K free on the heap.

Refer to Where is my RAM ?, i want more ! - ESP32 Forum

1 Like