brk

Determines the lowest virtual address that is not used with the program.

Format

#include  <stdlib.h>

void *brk  (unsigned long int addr);

Argument

addr
The lowest address, which the function rounds up to the next multiple of the page size. This rounded address is called the break address.

Description

An address that is greater than or equal to the break address and less than the stack pointer is considered to be outside the program's address space. Attempts to reference it will cause access violations.

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

Return Values
The new break address. 
(void *)(-1)  Indicates that the program is requesting too much memory. errno and vaxc$errno are updated. 

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