<pre> Below is a C program that you can compile and run on your WIN2K machine. The program will give you a rough idea of how much memory your machine will allow for a given process. [NOTE: You can use this C program on LINUX/SOLARIS/HPPA as well.]
void main(int argc, char **argv){ long chunks = 0; void *pmem; int nelem=1; int index=0;
printf("\n***Allocating all available memory\n"); printf("***Allocating 1 32K element at a time\n");
while (pmem=calloc(nelem,(size_t)CHUNK)){ chunks = chunks + nelem; switch(chunks){ case 10: { printf("***Increasing to 2 32K elements per allocation\n"); nelem = 2; break; } case 32: printf("... 1 MB\n"); break; case 40: { nelem = 4; printf("***Increasing to 4 32K elements per allocation\n"); break; } case 320: printf("... 10MB\n"); break; case 3200: printf("... 100MB\n"); break; case 8192: printf("... 256MB\n"); break; case 16384: printf("... 512MB\n");break; case 24576: printf("... 768MB\n"); break; case 32768: printf("... 1GB\n"); break; case 40960: printf("... 1.2GB\n"); break; case 49152: printf("... 1.5GB\n"); break; case 57344: printf("... 1.7GB\n"); break; case 65532: printf("... 2GB (solaris 2.5.1 limit)\n"); break; case 73728: printf("... 2.2GB\n"); break; case 81920: printf("... 2.5GB\n"); break; case 90112: printf("... 2.7GB\n"); break; } }
printf("\nAllocated %d 32KB Chunks\n", chunks); printf("Total allocated memory is %d MBytes\n", (chunks * CHUNK)/MBYTE); printf("\n***Press <enter> to free the memory and exit\n"); getchar();