Traverses stack from the watermark until it finds used space (debug only).
#include <stdlib.h> size_t stackwatermark ( void );
If the stack has been “doped,” returns the maximum amount of the stack that was ever used by the calling thread. Otherwise, returns 0.
This function requires the version of LibC compiled with DEBUG. This debug version dopes the stack of each new thread by painting the entire stack with "stak" before thread execution begins. The stackwatermark function uses this doping to determine how much of the stack has been used by the thread by locating the undisturbed remainder. The non-debug version of LibC and POSIX NLMs do not dope the stack.
On Intel processors, the stack grows numerically downward from the base address rather than upward.