The GlobalDiscard function discards the specified global memory block. The lock count of the memory object must be zero.
HGLOBAL GlobalDiscard(
HGLOBAL hglbMem | // handle to the global memory object |
); |
Parameters
hglbMem
Identifies the global memory object. This handle is returned by either the GlobalAlloc or GlobalReAlloc function.
Return Values
If the function succeeds, the return value is the handle of the memory object.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
GlobalDiscard discards only global objects that the calling process allocated with the GMEM_DISCARDABLE flag. If a process attempts to discard a fixed or locked object, the function fails.
Although GlobalDiscard discards the object's memory block, the handle of the object remains valid. A process can subsequently pass the handle to the GlobalReAlloc function to allocate another global memory block identified by the same handle.
See Also