|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
#include <unistd.h> void *sbrk(int delta)
This function changes the "break" of the program by adding delta
to it. This is the highest address that your program can access without
causing a violation. Since the heap is the region under the break, you
can expand the heap (where
malloc gets memory from) by increasing
This function is normally accessed only by
malloc (see section malloc).
The address of the first byte outside of the previous valid address range, or -1 if no more memory could be accessed. In other words, a pointer to the chunk of heap you just allocated, if you had passed a positive number.
char *buf; buf = sbrk(1000); /* allocate space */
|webmaster||delorie software privacy|
|Copyright © 2004 by DJ Delorie||Updated Apr 2004|