Platform SDK: Memory

GlobalDiscard

The GlobalDiscard function discards the specified global memory block. The lock count of the memory object must be zero.

Note  The global functions are slower than other memory management functions and do not provide as many features. Therefore, new applications should use the heap functions. However, the global functions are still used with DDE and the clipboard functions.

HGLOBAL GlobalDiscard(
  HGLOBAL hglbMem  // handle to global memory object
);

Parameters

hglbMem
[in] Handle to 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 a handle to the memory object.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

Although GlobalDiscard discards the object's memory block, the handle to the object remains valid. The process can subsequently pass the handle to the GlobalReAlloc function to allocate another global memory block identified by the same handle.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winbase.h; include Windows.h.

See Also

Memory Management Overview, Memory Management Functions, GlobalAlloc, GlobalReAlloc