STACK(3)

NAME
_beginStackCheck, _endStackCheck - report stack usage

SYNOPSIS
#include <gno/gno.h>
void _beginStackCheck(void);
int  _endStackCheck(void);

DESCRIPTION
These routines are intended to determine the required stack usage for a program during the development cycle.

_beginStackCheck should be called as soon as possible after the program starts. _endStackCheck should be called just prior to program exit. _endStackCheck will return the number of bytes of stack space used by the program. The result can then be used as a lower bound for the argument to occ's -s flag, or the stacksize pragma for Orca/C.

EXAMPLE
An easy way to use these set of routines is to make use of the atexit(3) function, so that you don't have to determine all the possible exit points of your program.
  #include <stdio.h>
  #include <gno/gno.h>
  void cleanup (void) {
    fprintf(stderr,"Stack Usage: %d bytes, _endStackCheck());
  }
  void main (int argc, char **argv) {
    _beginStackCheck();
    atexit(cleanup);
    ... <program continues> ...

AUTHOR
Phillip Vandry <vandry@cam.org>

HISTORY
These routines first appeared as stand-along object file, under the names begin_stack_check and end_stack_check. They were first incorporated into GNO in v2.0.6.

SEE ALSO
occ(1), atexit(1), Orca/C Reference Manual, Chapter 12.