Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
WinAvailMem (1.2)
◄Function Group► ◄Overview► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_WINHEAP
USHORT WinAvailMem(hHeap, fCompact, cbMinFree)
HHEAP hHeap; /* handle of the heap */
BOOL fCompact; /* memory-compaction flag */
USHORT cbMinFree; /* amount of storage requested */
The WinAvailMem function returns the size of the largest free block on the
heap.
Parameter Description
────────────────────────────────────────────────────────────────────────────
hHeap Identifies the heap. This handle must have been created by a
previous call to the WinCreateHeap function.
fCompact Specifies the memory-compaction flag. If TRUE, the heap is
reorganized. If FALSE, the heap is not reorganized.
cbMinFree This parameter is currently not used, but should be set to the
amount of storage the caller is requesting. A future release may
use this value to limit the scope of the compaction.
Return Value
The return value is the largest memory block available if the function is
successful, or 0xFFFF if an error occurs.
Comments
If the passed heap was created with the HM_MOVEABLE option, the
reorganization entails moving all movable blocks toward the beginning of the
heap. The presence of fixed objects may inhibit the amount of movement that
can occur. While the compaction is occurring, the dedicated and nondedicated
free lists are reconstructed from any free blocks that cannot be filled by
the compactor.
If the passed heap was not created with the HM_MOVEABLE option, the
reorganization entails sorting all free lists into a single list in address
order, scanning the list for adjacent blocks to coalesce, and then
reconstructing the dedicated and nondedicated free lists.
No synchronization is done for this call. Multi-threaded applications should
use semaphores if more then one thread will be making this call to prevent
two or more threads from calling this function at the same time.
See Also
WinAllocMem, WinCreateHeap, WinFreeMem, WinReallocMem
♦