1
0
Fork 0

fix mem test

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@999 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 11 years ago
parent 4e78a9ddec
commit ed1a4b76a3

@ -338,22 +338,22 @@ int main()
int count = 0;
void *p;
void *memory;
xc_mem_t *mem;
void **ptrs;
xc_mem_t mem_holder, *mem = &mem_holder;
int size, i;
#if 0
fprintf(stderr, "%s", "Input test size: ");
scanf("%d", &size);
#else
size = 100;
size = 1024;
#endif
CHECK(memory = malloc(size), "OOM");
CHECK(ptrs = malloc(size * sizeof(void *)), "OOM");
CHECK(mem = xc_mem_init(memory, mem, size), "Failed init memory allocator");
mem = (xc_mem_t *) memory;
CHECK(mem = xc_mem_init(NULL, mem, size), "Failed init memory allocator");
while ((p = xc_mem_malloc(mem, 1))) {
fprintf(stderr, "%d %p\n", count, ptrs);
ptrs[count ++] = p;
}
fprintf(stderr, "count=%d, random freeing\n", count);

Loading…
Cancel
Save