DWORD GlobalCompact(dwMinFree) | |||||
DWORD dwMinFree; | /* amount of memory requested | */ |
The GlobalCompact function rearranges memory currently allocated to the global heap so that the specified amount of memory is free. If the function cannot free the requested amount of memory, it frees as much as possible.
dwMinFree
Specifies the number of contiguous free bytes desired. If this parameter is zero, the function does not discard memory, but the return value is valid.
The return value specifies the number of bytes in the largest free global memory object in the global heap. If the dwMinFree parameter is zero, the return value specifies the number of bytes in the largest free object that Windows can generate if it removes all discardable objects.
If an application passes the return value to the GlobalAlloc function, the GMEM_NOCOMPACT or GMEM_NODISCARD flag should not be used.
This function always rearranges movable memory objects before checking for free memory. Then it checks the memory currently allocated to the global heap for the number of contiguous free bytes specified by the dwMinFree parameter. If the specified amount of memory is not available, the function discards unlocked discardable objects, until the requested space is generated (if possible).