Function Memory.availMem

AvailMem -- Get number of free bytes for given attributes

ulong availMem (
  MemFlags requirements
);

This function returns the amount of free memory given certain attributes.

To find out what the largest block of a particular type is, add MEMF_LARGEST into the requirements argument. Returning the largest block is a slow operation.

Warning

Due to the effect of multitasking, the value returned may not actually be the amount of free memory available at that instant.

Parameters

NameDescription
requirements a requirements mask as specified in AllocMem. Any of the AllocMem bits are valid, as is MEMF_LARGEST which returns the size of the largest block matching the requirements.

Returns

size - total free space remaining (or the largest free block).

Example

AvailMem(MEMF_ANY|MEMF_LARGEST); \* return size of largest available memory chunk *\

Notes

AvailMem(MEMF_LARGEST) does a consistency check on the memory list. SysError SEN_MemoryInsane will be pulled if any mismatch is noted.

See

AllocMem()