The following examples free the memory blocks of the example allocation
calls to AllocGPMem&, shown in the previous chapter.

    FreeGPMem apointer&, 100&
    FreeGPMem anotherptr&, 1000&

A memory block allocated with AllocGPMVec& must be returned to the GP Memory
system with the SUB FreeGPMVec.  This SUB uses the stored size in the
allocation to free the memory block, so there is no need to specify the
size of the memory block to free.

    FreeGPMVec yap&

FreeGPMem and FreeGPMVec return no status.  However, if you attempt to free
a memory block in the middle of a block that the system believes is already
free, you will cause the GPM system to panic with an error.  Programs should
free the same size memory blocks that they allocated.  An allocated block
should not be deallocated as smaller pieces.  Due to the internal way the
GPM system rounds up and aligns allocations, partial deallocations can cause
corruption of the GPM system's free memory list, if they are not carefully
pre-aligned.  Memory blocks allocated with AllocGPMVec& can never partially
deallocated in a safe way.

                                                      Back to GPM Functions