 | C166 User's Guide |  |
|
|
| xinit_mempool| Summary |
#include <stdlib.h>
void xinit_mempool (
void xhuge *p, /* start of memory pool */
unsigned long size); /* length of memory pool */
| | Description | The xinit_mempool function initializes the memory management routines and provides the starting address and size of the memory pool. The p argument points to a memory area in xdata which is managed using the xcalloc, xfree, xmalloc, and xrealloc library functions. The size argument specifies the number of bytes to use for the memory pool. Note | | Return Value | None. | | See Also | xcalloc, xfree, xmalloc, xrealloc | | Example |
#include <stdlib.h>
void tst_init_mempool (void) {
xdata void *p;
int i;
/* initialize memory pool at xdata 0x2000 for 4096 bytes */
xinit_mempool (&XBYTE [0x2000], 0x1000);
p = xmalloc (100);
for (i = 0; i < 100; i++)
((char *) p)[i] = i;
xfree (p);
}
|
|
|