deciding on stack and heep size

Hello

I have a general question. Is there a method to find how much should be the size of stack and heep?
I mean for example for a microcontroller with a 20KByte of SRAM what makes the developer to decide on the size of stack and heep?

More questions in this forum