glenda.party
term% ls -F
term% pwd
$home/manuals/unix_v8/2/brk
term% cat index.txt
BRK(2)                        System Calls Manual                       BRK(2)



NAME
       brk, sbrk, break - change core allocation

SYNOPSIS
       char *brk(addr)

       char *sbrk(incr)

DESCRIPTION
       Brk  sets the system's idea of the lowest location not used by the pro‐
       gram (called the break) to addr (rounded up to the next multiple of  64
       bytes  on  a  PDP11  and 1024 bytes on a VAX).  Locations not less than
       addr and below the stack pointer are not in the address space and  will
       thus cause a memory violation if accessed.

       In  the  alternate function sbrk, incr more bytes are added to the pro‐
       gram's data space and a pointer to the start of the  new  area  is  re‐
       turned.   (Rounding  occurs  as with brk, but a nominal break is remem‐
       bered, so rounding does not accumulate.)

       When a program begins execution via exec the break is set at the  high‐
       est  location  defined by the program and data storage areas.  Ordinar‐
       ily, therefore, only programs with  growing  data  areas  need  to  use
       break.

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

DIAGNOSTICS
       Zero  is  returned  if the brk could be set; -1 if the program requests
       more memory than the system limit or if too many segmentation registers
       would be required to implement the break.  Sbrk returns -1 if the break
       could not be set.



                                                                        BRK(2)