Hi,
The Compiler can just know static RAM usage, but it can't say maximum dynamic RAM usage.
Even without using dedicated dynamic memory control (using malloc) the stack usage is not predictable.
One can easily generate a software that causes stack overflow.
For debugging I sometimes check the stack pointer regularily within the software (usually in a regularily called ISR) to monitor "maximum stack usage".
I can read the "max value" out to compare it with my expectation.
The "expectation" is determined by the "deepest call of function" times (each stacked) variable usage plus ISR stack usage.
Klaus