Determines the lowest virtual address that is not used with the
program.
Format
#include <unistd.h>
void *sbrk (long int incr);
Argument
- incr
- The number of bytes to add to the current break address.
Description
This 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.
Return Values
x | The old break address. |
(void *)(-1) | Indicates that the
program is requesting too much memory. |
Restriction
Unlike other C library implementations, the DEC 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.
Previous Page | Next Page | Table of Contents | Index