|
| xmalloc| Summary | |
#include <stdlib.h>
void xhuge *xmalloc (
unsigned long size); /* block size to allocate */
| | Description | | The xmalloc function allocates a memory block from the memory pool of size bytes in length. Note - Source code for this routine is provide in the LIB folder. You may modify the source to customize this function for your particular hardware environment.
- This function uses xhuge pointers to objects and may be used in any memory model other than Tiny Model.
| | Return Value | | The xmalloc function returns a pointer to the allocated block or a null pointer if there is not enough memory to satisfy the allocation request. | | See Also | | xcalloc, xfree, xinit_mempool, xrealloc | | Example | |
#include <stdlib.h>
#include <stdio.h> /* for printf */
void tst_malloc (void) {
void xhuge *p;
p = xmalloc (1000); /* allocate 1000 bytes */
if (p == NULL)
printf ("Not enough memory space\n");
else
printf ("Memory allocated\n");
}
|
|
|