Run time memory consumption on STM32 board

Hey all,

I have a pretty generic question about measuring the memory resources on the board in real time when some code (algo) is running on my stm32 board. are there some specific ways to do it?

-  Either by C code insertion?

-  Using some simulator to simulate the memory behavior in real time?

Best,

Fahad