Here is the ESP32 recourse usage report in Arduino:
Sketch uses 151,467 bytes (14%) of program storage space. Maximum is 1,044,464 bytes.
Global variables use 20,496 bytes (6%) of dynamic memory, leaving 274,416 bytes for local variables. Maximum is 294,912 bytes.
My SPI flash size is 4 Mbytes so why it is limited by Arduino?
The same for internal SRAM memory. ESP32 has 520 KB Internal SRAM but as you can see from the report it is 294,912 bytes.