|Syntax||buffer = RESERVE_HEAP(length)|
This function obtains a chunk of memory for your program to use, the starting address is returned as the result of the call. Note that the function will ask for 4 bytes more than you require, these are used to store a flag so that calls to READ_HEADER do not crash the system by attempting to deallocate invalid areas of memory. If you call this function, the returned address is the first byte that your program can use.
The following example shows how this function can be used to reserve a buffer for READ_HEADER, described elsewhere.
1000 buffer = RESERVE_HEAP(64) 1010 IF buffer < 0 1020 PRINT 'ERROR allocating buffer, ' & buffer 1030 STOP 1040 END IF 1050 error = READ_HEADER(#3, buffer) .....do something with buffer contents here 2040 REMark Finished with buffer 2050 RELEASE_HEAP buffer