Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function frees the specified local memory object and invalidates its handle.
HLOCAL LocalFree( HLOCAL hMem );
Parameters
Return Values
NULL indicates success. A handle to the local memory object indicates failure. 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 hMemparameter is NULL, LocalFreeignores the parameter and returns NULL.
The LocalFreefunction will free a locked memory object. A locked memory object has a lock count greater than zero.
If an application is running under a debug version of the system, LocalFreeissues a message that tells you that a locked object is being freed. If you are debugging the application, LocalFreeenters a breakpoint just before freeing a locked object. This allows you to verify the intended behavior and then continue execution.
For Windows CE versions 1.0 through 2.12, allocating memory approximately 0 to 7 bytes under 192K in size causes the corresponding call to LocalFreeto fail for certain memory blocks in this size range. The return code is ERROR_INVALID_PARAMETER.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winbase.h | Lmem.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
GetLastError, LocalAlloc, LocalReAlloc