Platform SDK: Memory

LocalDiscard

The LocalDiscard function discards the specified local memory object. The lock count of the memory object must be zero.

Note  The local functions are slower than other memory management functions and do not provide as many features. Therefore, new applications should use the heap functions.

HLOCAL LocalDiscard(
  HLOCAL hlocMem   // handle to local memory object
);

Parameters

hlocMem
[in] Handle to the local memory object. This handle is returned by either the LocalAlloc or LocalReAlloc function.

Return Values

If the function succeeds, the return value is a handle to the local memory object.

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

Remarks

Although LocalDiscard discards the object's memory block, the handle to the object remains valid. A process can subsequently pass the handle to the LocalReAlloc function to allocate another local memory object 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, LocalAlloc, LocalReAlloc