Check stack size before operations