The query FUNCTION AvailGPMem& can provide the amount of memory available
in the GPM system from different points of view.  It may check for the
overall free size, the total memory size, or the free size of the largest
continuous free block.  As mentioned earlier, the GP Memory region is not
DIMed to the full extent of the given init maximum size, but will grow to
it as needed.  Because of this, all of the three different sizes mentioned
above can be seen either according to the current extent of the GPM region,
or according to the maximum given at init time.  For example, the call
"size& = AvailGPMem&(gpmF_Largest& + gpmF_NoAdd&)" would return the size&
of the largest continuous free block in the current region.  That is, the
largest block, which could be allocated right now, without causing the
actual memory region to grow (gpmF_NoAdd&).

You may use AvailGPMem& ahead of a big allocation, to find out, if there
is enough free memory to fit the request, but in general the FUNCTIONs
AllocGPMem& and AllocGPMVec& will return a zero result anyway, if the
allocation cannot be satisfied.  If used with the gpmF_Largest& flag, this
routine needs to traverse the entire free memory list to find the largest
continuous free memory block, this is a good opportunity to make a general
check on the integrity of the GPM system without wasting runtime.

                                                      Back to GPM Functions