(Slightly different from the UNIX version)
char *sbrk(); newaddr = sbrk(increment);
This function adds "increment" bytes to the amount of memory currently allocated for your program. This is automatically rounded up to the next multiple of 1024 words. If the program attempts to access addresses beyond the end of allocated memory, it will be aborted with a memory fault.
If "sbrk" cannot grow your program, the program is aborted. If "increment" is negative, "sbrk" returns a NULL pointer.
"brk" and "sbrk" are only included for compatibility with UNIX. Using these functions to grow your program may cause conflicts with "malloc" and other functions. The only really sensible use of "sbrk" is
sbrk(0)
which will return a pointer to the end of your program's allocated memory, thereby telling you how big your program is.
Copyright © 1996, Thinkage Ltd.