Memory System Calls
There are two main system calls to manipulate memory,
namely brk and sbrk.
Both brk and sbrk change the amount of space allocated for the
calling process's data segment.
the process's break value and the operating system adjusts
their allocated amount of space accordingly, which may be an increase
or a decrease or no change.
The break value is the address
of the first memory location after the end of the data segment for
brk and sbrk are very rarely used because the malloc, calloc, and free
library functions are adequate for allocating and freeing memory
space; brk and sbrk should not be used in a program that
also uses mallocs/calloc and free.
Hercules documentation on brk and sbrk
A program that uses brk and sbrk.
Note that if sbrk is passed
an increase of 0 bytes, it can be used as a query function
to determine the current break value.
Output from brk.cpp
Table of Contents