Memory usage in PlatformIO's Inspect inconsistent?

Hi all, need to clarify on how to use PIO’s inspect feature. I am facing the same issue on a mega2560 project as in this thread where the RAM usage reported upon building is actually larger than that in the inspect explorer and there isn’t anything that I can see which can account for the discrepancy. Not sure if this is related to this open issue on how PIO is architecturally incorrect about RAM. Is the larger figure more accurate or the smaller figure more accurate on how much RAM I am using?

You’re having the general problem than that the “Debug” feature inspects the firmware when built in debug mode when memory usage is generally larger.

Best to compile in “MinSize with Debug Info” mode by setting build_flags = -g3 -ggdb3 -Wl,-Map,output.map to the platformio.ini, building, and either run the resulting .map file through amap or the .elf file through GitHub - ARMmbed/mbed-os-linker-report: Post-processing of linker output to calculate and visualize memory usage for elf-sections like I did e.g. in STM32g030k6p6 simple sketch overflows the flash memory? - #5 by maxgerhardt