Task Stack Overflow Escape Code

Description

Each task is provided with its own "stack", a place to keep track of temporary variables, parameters and procedure return points. Task stacks allow multiple tasks to share the same procedure, for example, and not interfere with each others information. This error has occurred because the task stack has run out of space. The best solution for this type of problem is to make variables global rather than "local", or stack based, by placing the "static" keyword after local variables. Vectors, in particular, consume task stack space because they can be large. This saves task stack space, however if the routine is used by more than one task at the same time, each task will be working with the same global memory. This technique should only be used if just one task is calling a particular procedure. Recursion techniques are permitted. If a recursive procedure does not have a proper termination condition this type of stack overflow error can occur. After experiencing a task stack overflow it is best to save your work, exit from the program, power cycle the controller, and return to the project.

Related Topics

Escape Codes