_hfree

Description

Frees a huge memory block.

#include <malloc.h> Required only for function declarations  

void _hfree( void __huge *memblock );

memblock Pointer to allocated memory block  

Remarks

The _hfree function deallocates a memory block; the freed memory is returned to the operating system. The memblock 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.

Note that attempting to free an invalid memblock argument (one not allocated with _halloc) may affect subsequent allocation and cause errors.

Return Value

None.

Compatibility

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:None

See Also

_halloc

Example

/* HALLOC.C: This program uses _halloc to allocate space for 30,000 long

* integers, then uses _hfree to deallocate the memory.

*/

#include <stdio.h>

#include <stdlib.h>

#include <malloc.h>

void main( void )

{

long __huge *hbuf;

/* Allocate huge buffer */

hbuf = (long __huge *)_halloc( 30000L, sizeof( long ) );

if ( hbuf == NULL )

printf( "Insufficient memory available\n" );

else

printf( "Memory successfully allocated\n" );

/* Free huge buffer */

_hfree( hbuf );

}

Output

Memory successfully allocated