FreeMemSys
FreeMem Get amount of free space in current heap zone
#include <Memory.h> Memory Manager
long FreeMem( );
returns free space in current heap zone
FreeMem returns the total amount of free space, in bytes, in the current
heap zone. It usually won't be possible to allocate a single block this large
since the heap may be fragmented by locked and/or nonrelocatable blocks.
Returns: a long; the total, in bytes, of all un allocated memory in the current
heap zone.

Notes: There is another routine, FreeMemSys, which performs the equivalent
operation to FreeMem, but in the System heap zone. It takes the same
parameters as FreeMem.
FreeMem returns total free space. Use MaxBlock or PurgeSpace to
get the size of the maximum allocation you can make. Use CompactMem,
PurgeMem, or MaxMem to force a garbage collection and learn about
available allocation space.