Stack size

The stack size is determined by the implementation of the wrapper thread object <env>Thread, derived from the OMOSThread interface. Specifically, the stack size is defined in the constructor body, which is executed upon the thread creation call. For example, in the constructor for a VxThread object in VxWorks, the stack size is set to the default value of OMOSThread::DefaultStackSize in VxOS.h, as follows:

VxThread(void tfunc(void *), void *param,
   const char* const name = NULL,
   const long stackSize = 
   OMOSThread::DefaultStackSize);

DefaultStackSize in OMOSThread is set to DEFAULT_STACK (defined as 20000 for VxWorks) in the VxOS.cpp file, as follows:

const long OMOSThread::DefaultStackSize = DEFAULT_STACK;

To change the size of the stack for all new threads, change the definition of DEFAULT_STACK in the <env>OS.h file. Alternatively, you can change the size of the stack for a particular thread by passing a different value as the fourth parameter to the thread constructor.


Feedback