The LocalFree function frees the specified local memory object and invalidates its handle.
HLOCAL LocalFree(
HLOCAL hMem |
// handle of local memory object |
); |
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.
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 and LocalFree will free a locked memory object. However, if you run an application under a debug version of Windows NT or Windows 95, both GlobalFree and LocalFree will issue a message that tells you that this is happening. If you are debugging the application, GlobalFree and LocalFree will enter a hard-coded breakpoint just before freeing a locked object. This lets you double-check the intended behavior.
GlobalFree, LocalAlloc, LocalFlags, LocalLock, LocalReAlloc, LocalUnlock
file: /Techref/os/win/api/win32/func/src/f54_8.htm, 3KB, , updated: 2000/4/7 11:19, local time: 2024/11/28 08:26,
3.145.103.100:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/techref/os/win/api/win32/func/src/f54_8.htm"> LocalFree</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.