LocalFree
The LocalFree
function frees the specified local memory object and invalidates its handle.
HLOCAL LocalFree(
HLOCAL hMem |
// handle of local
memory object |
); |
|
Parameters
hMem
Identifies
the local memory object. This handle is returned by either the LocalAlloc
Return Values
If the
function succeeds, the return value is NULL.
If the
function fails, the return value is equal to the handle of the local memory
object. To get extended error information, call GetLastError
Remarks
If the
process tries to examine or modify the memory after it has been freed, heap
corruption may occur or an access violation exception
(EXCEPTION_ACCESS_VIOLATION) may be generated.
If the hMem
parameter is NULL, LocalFree ignores the parameter and returns NULL.
LocalFree succeeds even if the memory object is locked by a
previous call to the LocalLock function. The LocalLock function
locks a local memory object and increments the lock count by one. The LocalUnlock
function unlocks it and decrements the lock count by one. To get the lock count
of a local memory object, use the LocalFlags function. LocalFree
will free a locked memory object. A locked memory object has a lock count
greater than zero.
Both GlobalFree
See Also