man(1) Manual page archive


     BRK(2)                                                     BRK(2)

     NAME
          brk, sbrk - change core allocation

     SYNOPSIS
          int brk(addr)
          char *addr;

          char *sbrk(incr)

     DESCRIPTION
          Brk sets the system's idea of the lowest location not used
          by the program (called the break) to addr rounded up to the
          next multiple of 1024 bytes.  Locations not less than addr
          and below the stack pointer may cause a memory violation if
          accessed.

          In the alternate function sbrk, incr more bytes are added to
          the program's data space and a pointer to the start of the
          new area is returned.  Rounding occurs as with brk, but a
          nominal break is remembered, so rounding does not accumu-
          late.

          When a program begins execution via exec the break is set at
          the highest location defined by the program and data storage
          areas.  Ordinarily, therefore, only programs with growing
          data areas need to use brk.

          The error return from sbrk is (char *)-1.

     SEE ALSO
          exec(2), end(3), malloc(3)

     DIAGNOSTICS
          ENOMEM