Getting stack and heap memory usage on Nano RP2040

I've been tracking down a random crash bug I have been getting on my Nano RP2040.

I have replaced all of the use of Strings with char (because I had read about a memory leak issue with using Strings). Afterwards, the crash bugs have happened less frequently, but are still occurring. I suspect that my crash issue is due memory (it's quite a large and complicated sketch).

Does anyone know how to get the free memory (stack and heap) for a running sketch on the RP2040 architecture? All of the methods I have found have been for other/older systems.

Thanks in advanced.

  • Chuck