#include #include #include #define MEM (200 * 1024 * 1024) #define CHUNK (127 * 1024) void *p[MEM/CHUNK + 1]; int main() { int i; for (i = 0; i < MEM/CHUNK; i++) { p[i] = malloc(CHUNK); memset (p[i], 0x83, CHUNK); } fgetc(stdin); printf("freeing odd ones\n"); for (i = 1; i < MEM/CHUNK; i += 2) free (p[i]); fgetc(stdin); printf("freeing even ones\n"); for (i = 0; i < MEM/CHUNK; i += 2) free (p[i]); fgetc(stdin); return 0; }