GETVEC/RLSEVEC - dynamically allocate/release a vector.

Alternate entries: .GETVE/.RLSEV

Usage:

B:
   vec = getvec( size );
   rlsevec( vec, size );
C:
   int getvec(int size);
   void rlsevec(int vec, int size);

Where:

size
specifies the maximum index for the vector being allocated or released. This is one less than the actual number of words in the vector.
vec
is a pointer to the vector which has been obtained or which is being released.

Description:

GETVEC returns a pointer to a block of memory (a vector) of the requested size. GETVEC will allocate "size+1" words so that the last element may be referred to as "vec[size]". The memory allocated to "vec" is obtained from the free list, which initially contains the space following the user's program. If there is not enough space on the free list, the memory image is grown. In batch, if GETVEC cannot increase the memory size, it aborts with a "0k" abort.

RLSEVEC is used to free the space occupied by a vector which was allocated by GETVEC, given the pointer to the vector and its size.

Any attempt to release a vector which is already wholly or partially on the free storage list, results in an immediate fault tag fault.

It is possible to release only parts of a vector if you are careful, provided that the parts you release are not already on the free storage list. For that matter, you can release any storage which is not already on the free list.

Releasing a vector whose address is lower in memory than RLSEVEC itself, results in an immediate fault tag fault. For example, if RLSEVEC is loaded starting at location 7300 (octal), you may not release a vector whose address is in the range from zero to 7300 (octal).

See Also:

expl b lib allocate

Copyright © 2000, Thinkage Ltd.