stack size calculation