/*-=-=-=-=-=-=-=-=-=-=-=- RCCL/RCI Notice of Copyright -=-=-=-=-=-=-=-=-=-=-*
 *									    *
 *	Copyright (C) 1991 by John E. Lloyd.				    *
 *									    *
 *	Information on copyright permissions, as well as a complete	    *
 *	disclaimer of warranty, is given in the file COPYRIGHT.		    *
 *									    *
 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#define PAGESIZE   4096

char **argvec;

main(argc, argv)
int argc;
char **argv;
{
	int i;
	int pagesize;
	int size;
	char *addr;

	argvec = argv;

	argc--; argv++;
	if (argc != 1)
	 { printf ("Usage: %s <allocation size (hex)>\n", argvec[0]);
	   exit (-1);
	 }
	sscanf (*argv, "%x", &size);
	pagesize = getpagesize();
	printf ("allocating %d pages\n", size/pagesize);

	addr = (char*)sbrk(size);
	for (i=0; i<size; )
	 { addr[i] = i;
	   addr[irandom(0,size-1)] = i;
	   if ((i += pagesize) >= size)
	    { i = 0;
	      printf ("all memory hit\n");
	    }
	 }
}

	
