Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ stack(DOS) — System V/386 Software Development System 3.2.2b

Media Vault

Software Library

Restoration Projects

Artifacts Sought

     Name
          stackavail - Returns size of available stack space.

     Syntax
          #include <malloc.h>

          size_t stackavail(void)

     Description
          The stackavail function returns the approximate size in
          bytes of the stack space available for dynamic memory
          allocation with alloca.

     Return Value
          The stackavail function returns the size in bytes as an
          unsigned integer value.

     See Also
          alloca(DOS), _freect(DOS), memavl(DOS)

     Example
          #include <malloc.h>

          main()

          {
                  char *ptr;

                  printf("Stack memory available before");
                  printf(" alloca = %u\n", stackavail( ));

                  ptr = alloca(1000*sizeof(char));

                  printf("Stack memory available after");
                  printf(" alloca = %u\n", stackavail( )); }

          Sample output:

            Stack memory available before alloca = 1682
            Stack memory available after alloca = 678

          This program uses stackavail to determine the amount of free
          space available on the stack. It then allocates memory from
          the stack and calls stackavail again to display the new
          amount of available free space.

                                                (printed 6/18/89)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026