stackwatermark

Traverses stack from the watermark until it finds used space (debug only).

Library:LibC
Classification:Other
Service:Memory Management

Syntax

  #include <stdlib.h> 
   
  size_t stackwatermark ( void );
  

Return Values

If the stack has been “doped,” returns the maximum amount of the stack that was ever used by the calling thread. Otherwise, returns 0.

Remarks

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.

See Also