From aldeid
Jump to navigation Jump to search


Frees the specified global memory object and invalidates its handle.

Note The global functions have greater overhead and provide fewer features than other memory management functions. New applications should use the heap functions unless documentation states that a global function should be used.


<syntaxthighlight lang="cpp" HGLOBAL WINAPI GlobalFree(

 _In_ HGLOBAL hMem

); </syntaxhighlight>


hMem [in]
A handle to the global memory object. This handle is returned by either the GlobalAlloc or GlobalReAlloc function. It is not safe to free memory allocated with LocalAlloc.

Return value

If the function succeeds, the return value is NULL.

If the function fails, the return value is equal to a handle to the global memory object. To get extended error information, call GetLastError.