Hum, may be I was over optimistic regarding alloca(), it seems it core dumps as well :-), i.e never return NULL.
I was mentioning alloca() because I use to do my own stacksize check using getrlimit() and getting the max stack size, and measuring the distance between the stack_base and the recursion stack level to iner how much stack remains, I didn't wanted to talk about that but seems it is the last resort... Well not a simple case to handle.