I have MultiThreaded Application in Linux.
I am Setting the stack size using pthread_attr_setstacksize.
The stack size i set is greter than PTHREAD_STACK_MIN i.e. 16384 bytes for my system.
i am setting the stack size to 17408 bytes, and my application crashes due to insufficient stack size. when i set the stack size to 17920 my application runs successfully.
But from my gathered statistics from /proc/<MY PROCESS PID>/task/<TID>/stat , the maximum stack size per thread ( which is the difference of stack pointer and bottom of stack) is not greater than 8KB or 9KB , then why is the process crashing at stack size 17408 bytes i.e. around 16KB.
Kindly do clarify my doubts.
Thanking you in anticipation.