PlatformIO just has the wrong value here for maximum RAM.
Since it’s a regular ESP32 chip, it does should have the same
like esp32dev. And yes that’s not 540KB of “RAM”, but that’s because we’re couning DRAM here not IRAM (plus no PSRAM included in calculation).
That number if just wrong. I think it detects the end of the sketch by a magic linker script symbol. Either PlatformIO is not defining it to the right value here of the Arduino-ESP32 core has a bug (in e.g. the linker script).
Does it show the same free sketch size in the Arduino IDE?
Sketch uses 228333 bytes (17%) of program storage space. Maximum is 1310720 bytes.
Global variables use 21976 bytes (6%) of dynamic memory, leaving 305704 bytes for local variables. Maximum is 327680 bytes.