A) Yes, of course, the goal is pthread_attr_setstacksize .
B) Yes, calling pthread_detach or pthread_join causes thread resources to recover after completion.
C) Theoretically, yes, but since on most systems the stack grows in the opposite direction (from high to low), you will need to do some kind of buffer overflow to get out of your current stack space.
source share