| Example | |
#include <rtl.h>
/* Reserve a memory for 32 blocks of 20-bytes. */
U32 mpool[32*5 + 3];
void membox_test (void) {
U8 *box;
U8 *cbox;
_init_box (mpool, sizeof (mpool), 20);
box = _alloc_box (mpool);
/* This block is initialized to 0. */
cbox = _calloc_box (mpool);
.
.
_free_box (mpool, box);
_free_box (mpool, cbox);
}
|