Returns the amount of all free memory in the heap.
function MemAvail: Longint;
Windows, Real, Protected
MemAvail returns the sum of the sizes of all free blocks in the heap. Note that a contiguous block of storage the size of the returned value is unlikely to be available due to fragmentation of the heap. To find the largest free block, call MaxAvail.
In DOS real mode, MemAvail is calculated by adding the sizes of all free blocks below the heap pointer to the size of free memory above the heap pointer. Your program can specify minimum and maximum heap requirements using the $M directive.
In DOS protected mode and Windows, MemAvail calculates the amount of free memory available by calling the GetFreeSpace function and adding to that the size of each free block in the heap manager's sub-allocation space.