#include <stdio.h>
#include <aitsess.h>
int
main(int argc, char **argv)
{
mpool_t *mp;
void *addr;
int i;
for (i = 0; i < 3; i++) {
addr = malloc(4000);
printf("addr=%p\n", addr);
free(addr);
}
mp = mpool_init();
if (!mp) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
return 1;
}
for (i = 0; i < 3; i++) {
addr = mpool_malloc(mp, 4000, "mdaaa 4000");
if (!addr) {
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError());
mpool_destroy(&mp);
return 2;
}
printf("addr=%p chkaddr=%d addr_size=%d\n", addr, mpool_chkaddr(addr), mpool_getsizebyaddr(addr));
strlcpy(addr, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ndddddd\n",
mpool_getsizebyaddr(addr));
mpool_free(mp, addr, 0);
}
mpool_purge(mp, 1);
mpool_destroy(&mp);
return 0;
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>