Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This C program named memeater consumes some physical memory in a fairly short time period. We basically allocate and reference 100MB every 2 seconds for 10 iterations for a total of = 1GB: 

------ start of memeater.c -------------

...

    int x;
    for( x = 1; x <= 10 ; x++){
        char *myptr;
        myptr = malloc(HUNDRED_MB );
        int y;
        /* Dereference memory pointer so we use physical RAM */
        for(y = 0; y < HUNDRED_MB; y++){
            myptr[y] = 0;
        }
        printf("%d MBs allocated\n", x * HUNDRED_MB / 1048576);
        sleep(2);
    }
}
------ end of memeater.c -------------

Compile the executable and submit as a job for a specific host that does not have cgroups enabled. We will also specify a physical memory limit of 350MB: "bsub -q systems -m pinto21 -M 350 ./memoryeater". Open a terminal session on the target batch host and run "top -a -u <your_uid>" to monitor processes listed in order of memory usage. The job should run for ~20secs and while it is running you should see the amount of physical resident memory it consumes ("RES") increment. The job will run beyond the requested 350MB limit and probably run to completion and exit normally. This is because LSF is simply checking memory use periodically and jobs may exceed memory limits between these check intervals.