This code was sent to John W. by the support staff of one of the larger software vendors with the stated purpose of determining how much memory a program could use on one of the corporation's Unix servers. 

#include <stdio.h>
#include <malloc.h>
 
int
 
main ()
{
float f;
char *p;
 
   while (1)
   {
      p = malloc(102400);
      if (!p)
         {
          printf ("malloc returned NULL\n");
          exit(1);
         }
  
      f += 102400;
      printf ("%g\n", f);
      printf ("%g %f %f MB\n", f, f, f/1024000);
  
   }
}

Now, fair readers, if you were to compile and run this code you your PC, as I did, you should see the WTF for yourself with no problems (spoiler: XP said I was running low on resources). 

However, John was asked to run this program...in an environment that ran 24/7.  In the interest of appeasing vendor support, John did run it, but not until imposing some limits on how high "f" could go.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!