What caps argument to give to ESP32 heap_caps_…() functions?

Almost all of the ESP32 heap_caps_...() functions take a uint32_t caps argument.

In case you just want to have general information about the heap, use

MALLOC_CAP_DEFAULT

as an argument.

Most applications will rarely use any other value than MALLOC_CAP_DEFAULT. Other values which are used semi-frequently include:

  • MALLOC_CAP_SPIRAM
  • MALLOC_CAP_INTERNAL (memory must not be located in SPI RAM)
For more details on how the memory of the ESP32 is organized, see the official documentation.