/* * sparse.c * * This program declares a large array, but only uses a small * part of it. The intention is that the full array will not * fit into memory, but the used part of the array will fit. * * This is similar to testbin/huge. * */ #include #include /* * set these to match the page size of the * machine and the number of pages of physical memory * in the machine. */ #define PageSize 4096 #define NumPages 128 /* a large array, 2 times the size of physical memory */ #define ArraySize (2*NumPages*PageSize) char sparse[ArraySize]; int main() { int i,j; printf("Starting the sparse program\n"); /* write some values into the array, but only touch one array entry on every 10th page */ for (i=0; i