There is probably no need to report such information "on the fly", since the memory usage is statically determined when the code is linked. The link-map generated by your linker will provide this information.
What may be useful to determine at run-time is the heap and stack usage. Heap usage reporting, if possible will be entirely down to the C library you are using. For example using ARM's library, the __heapstats()
function will provide that.
"Water-marking" of stack memory involves filling it with a specific bit pattern and then scanning the stack to see where that pattern has been changed - that is indicative of maximum stack usage (the high water mark).
Some linkers are capable of performing static analysis of stack usage, and can report the worst case stack usage and call-path for any particular function. The analysis is however worst case and the call-path for which it is determined my never occur in real execution. Also such analysis cannot provide stack usage with calls made through function pointer variables or recursive functions.
Advice on stack usage analysis for various common scenarios (bare-metal, RTOS, memory-map and toolchain combinations) can be found in this article