测试 code
# cat memkindpool.c
#include
#include
int main(int argc, char **argv){
printf("argc [%d] \n", argc);
struct memkind *pool = NULL;
int res = -1;
char *ptr = NULL;
size_t capacity = 1;
capacity = atoi(argv[1]);
// 测试 16字节对齐
size_t allocate_size = 17;
allocate_size = atoi(argv[2]);
printf("capacity [%d] , allocate_size [%d]\n", capacity, allocate_size);
if((res = memkind_create_pmem("/mnt/pmem1/", capacity*1024*1024*1024, &pool)) == 0) {
printf("CREATE OK, capacity [%d] \n", capacity);
} else {
printf("CREATE FAILED\n");
return -1;
}
if ((ptr = memkind_malloc(pool, allocate_size)) != NULL) {
printf("MALLOC OK\n");