[Previous]
[Contents]
[Next]

halloc()

allocate space for a huge array

Synopsis:

#include <malloc.h>
void __huge *halloc( long int numb, size_t size );

Description:

The halloc() function allocates space for an array of numb objects of size bytes each, and initializes each object to 0. When the size of the array is greater than 64K bytes, then the size of an array element must be a power of 2, since an object could straddle a segment boundary.

Returns:

A far pointer (of type void __huge *) to the start of the allocated memory. NULL is returned if there is insufficient memory available. NULL is also returned if the size of the array is greater than 64K bytes, and the size of an array element is not a power of 2.

Examples:

#include <stdio.h>
#include <malloc.h>

void main()
  {
    long int __huge *big_buffer;

    big_buffer = (long int __huge *)
          halloc( 1024L, sizeof(long) );
    if( big_buffer == NULL ) {
      printf( "Unable to allocate memory\n" );
    } else {
      /* ... */
      hfree( big_buffer );  /* deallocate */
    }
  }

Classification:

WATCOM

Safety:
Interrupt handler Unknown
Signal handler Unknown
Thread Unknown

See also:

calloc(), _expand(), free(), hfree(), malloc(), _msize(), realloc(), sbrk()


[Previous]
[Contents]
[Next]