260 of 286
246 System.TaskHeadRoom Type Function returning UnsignedInteger Invocation System.TaskHeadRoom(taskStack) System.TaskHeadRoom() Parameter Method Type Description taskStack ByRef array of Byte The stack for a task of interest. Discussion This function determines the amount of space in task stack of the specified task that has never been used, irrespective of the current position of the task stack pointer. The primary use for it is to determine the amount of task stack space used by a task in order to balance the requirements of the heap and the various task stacks. If the supplied parameter does not refer to a valid task stack (i.e. a stack for a task that is in the task list), the return value will be &Hffff. For the second form, with no task stack specified, the stack of the calling task is examined. In either case, if zero is returned it is nearly certain that the task stack has overflowed, possibly overwriting adjacent data. Compatibility For VM mode devices, calling this function for the Main() task will always return &HFFFF unless you have specified a stack limit for Main(). See the Option StackLimit directive and related directives for more information. See Also System.HeapHeadRoom