#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define SIZE ((unsigned long)(64 * 1024))

int main (void)
{
	unsigned char *buf;
	unsigned long total = 0L;

	for (;;) {

		if ((buf = malloc (SIZE)) == NULL) {
			fprintf (stderr,
				"malloc failed: total = %d = %dkB\n",
				total, total / 1024
			);
			return (1);
		}
		memset (buf, 42, SIZE);

		total += SIZE;

		printf ("Got total = %d = %dkB\n", total, total / 1024);
		fflush (stdout);
	}
	/* NOTREACHED */
	return (0);
}
