#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <stdio.h>

#define INCL_DOSPROCESS
#include <os2.h>

void main( int argc, char *argv[] )
{
   int       wait      = 30;
   int       increment = 4096;
   int       i         = 0;
   char     *bogus;
   char      m;

   if ( argc > 1 && ( strstr( argv[1], "?" ) != NULL ) )
   {
      printf( "Syntax: %s [increment] [wait]\n", strupr( argv[0] ) );
      return;
   }

   if ( argc > 1 )
   {
      increment = atoi( argv[1] );
   }

   if ( argc > 2 )
   {
      wait = atoi( argv[2] );
   }

   printf( "%s: allocation increment = %d, wait interval %d seconds\n",
           strupr( argv[0] ),
           increment,
           wait );

   for ( ; ; )
   {
      bogus = malloc( increment );
      if ( bogus == NULL )
      {
         printf( "ERROR: malloc() failure.\n" );
         return;
      }

      printf( "allocated (%i attempts) = %i\n", ++i, i*increment );

      DosSleep( wait * 1000 );
   }

}

