GlobalFree

2.x

  HGLOBAL GlobalFree(hglb)    
  HGLOBAL hglb; /* handle of object to free */

The GlobalFree function frees the given global memory object (if the object is not locked) and invalidates its handle.

Parameters

hglb

Identifies the global memory object to be freed.

Return Value

The return value is NULL if the function is successful. Otherwise, it is equal to the hglb parameter.

Comments

The GlobalFree function cannot be used to free a locked memory object—that is, a memory object with a lock count greater than zero. For a list of the functions that affect the lock count, see the description of the GlobalFlags function.

Once freed, the handle of the memory object must not be used again. Attempting to free the same memory object more than once can cause Windows to terminate abnormally.

See Also

GlobalDiscard, GlobalFlags, GlobalLock