HELPLIB.HLB  —  CRTL  sbrk
    Determines the lowest virtual address that is not used with the
    program.

    Format

      #include  <unistd.h>

      void *sbrk  (long int incr);

1  –  Argument

 incr

    The number of bytes to add to the current break address.

2  –  Description

    The sbrk function adds the number of bytes specified by its
    argument to the current break address and returns the old break
    address.

    When a program is executed, the break address is set to the
    highest location defined by the program and data storage areas.
    Consequently, sbrk is needed only by programs that have growing
    data areas.

    sbrk(0) returns the current break address.

3  –  Return Values

    x                  The old break address.
    (void *)(-1)       Indicates that the program is requesting too
                       much memory.

4  –  Restriction

    Unlike other C library implementations, the C RTL memory
    allocation functions (such as malloc) do not rely on brk or
    sbrk to manage the program heap space. Consequently, on OpenVMS
    systems, calling brk or sbrk can interfere with memory allocation
    routines. The brk and sbrk functions are provided only for
    compatibility purposes.
Close Help