diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-09-04 13:25:24 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-09-04 13:25:24 -0700 |
commit | 5c70758542da772e66037ab2715a8f21dc5f8cf3 (patch) | |
tree | 14313f3793ef1ae255303d38ac21bd979824bc23 | |
parent | 07ae29c2cdedac32b8015ddc8103ad6dbf9d1195 (diff) |
some debug stuff for dlmalloc
-rw-r--r-- | tests/dlmalloc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/dlmalloc.c b/tests/dlmalloc.c index b4988dce..e6bf434d 100644 --- a/tests/dlmalloc.c +++ b/tests/dlmalloc.c @@ -5709,16 +5709,20 @@ int main(int ac, char **av) char* allocations[NUM]; for (int i = 0; i < NUM/2; i++) { allocations[i] = (char*)malloc((11*i)%1024 + x); + //printf("zz alloc: %d\n", (int)allocations[i]); assert(allocations[i]); if (i > 10 && i%4 == 1 && allocations[i-10]) { + //printf("zz free: %d\n", (int)allocations[i-10]); free(allocations[i-10]); allocations[i-10] = NULL; } } for (int i = NUM/2; i < NUM; i++) { allocations[i] = (char*)malloc(1024*(i+1)); + //printf("zz alloc: %d\n", (int)allocations[i]); assert(allocations[i]); if (i > 10 && i%4 != 1 && allocations[i-10]) { + //printf("zz free: %d\n", (int)allocations[i-10]); free(allocations[i-10]); allocations[i-10] = NULL; } @@ -5726,11 +5730,14 @@ int main(int ac, char **av) char* first = allocations[0]; for (int i = 0; i < NUM; i++) { if (allocations[i]) { + //printf("zz free: %d\n", (int)allocations[i]); free(allocations[i]); } } char *last = (char*)malloc(512); // should be identical, as we free'd it all + //printf("zz last: %d\n", (int)last); char *newer = (char*)malloc(512); // should be different + //printf("zz newer: %d\n", (int)newer); c1 += first == last; c2 += first == newer; } |