20 printf("pointer to x is %p\n", x);
21 printf("pointer to y is %p\n", y);
22 x=malloc(sizeof(int)*2000);
23 printf("pointer to x is %p\n", x);
24 y=malloc(sizeof(int)*100);
25 printf("pointer to y is %p\n", y);
28 printf("about to free(0)\n");
32 printf("x = %p\n", x);
33 memcpy(x, "Small string", 13);
34 printf("0x%p test string1: %s\n", x, (char *)x);
36 printf("0x%p test string1: %s\n", y, (char *)y);
37 memcpy(y, "********** Larger string **********", 36);
38 printf("0x%p test string2: %s\n", y, (char *)y);
42 printf("Allocate 100 nodes 500 bytes each\n");
44 for (i=0; i<100; i++) {
47 printf("loop 1: malloc returned 0\n");
54 printf("freeing 100 nodes\n");
61 printf("try realloc 100 times \n");
63 for (i=1; i<=100; i++) {
64 lp = realloc(lp, i*200);
66 printf("loop 3: realloc returned 0\n");
71 void *unused_ret = realloc(lp, 0);
75 printf("Allocate another 100 nodes 600 bytes each\n");
77 for (i=0; i<100; i++) {
80 printf("loop 2: malloc returned 0\n");
87 printf("freeing 100 nodes\n");
95 printf("alloc test PASSED\n");
99 printf("!!!!!!!!!!!! alloc test FAILED. !!!!!!!!!!!!!!!\n");