Name
hfree - Deallocates a memory block.
Syntax
#include <malloc.h>
void hfree(buffer)
void huge *buffer;
Description
The hfree function deallocates a memory block; the freed
memory is returned to the operating system. The buffer
argument points to a memory block previously allocated
through a call to halloc. The number of bytes freed is the
number of bytes specified when the block was allocated.
After the call, the freed block is available for allocation.
Return Value
None.
See Also
halloc(DOS)
Notes
Attempting to free an invalid buffer (one not allocated with
halloc) may affect subsequent allocation and cause errors.
Example
#include <malloc.h> #include <stdio.h>
main()
{
void huge *alloc;
alloc = halloc(80000L,sizeof(char));
/* Test for valid pointer: */
if (alloc != NULL){
/* Free memory for the heap: */
hfree(alloc);
printf("Memory successfully allocated ");
printf("and deallocated.\n);
}
else
printf("Insufficient memory available\n");
}
This program allocates space for 80,000 characters,
initializes this space to zeros, then uses hfree to
deallocate the memory.
(printed 6/18/89)