#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

char	*c;

int main(void)
{
  while (1)
  {
    int mb;
    int	sz;

    mb = (rand() % 17) + 1;
    sz = mb * 1024;

    c = malloc(sz);
    if (c == NULL)
    {
      printf("cannot allocate more\n");
      return 2;
    }
    printf("allocated %d kb\n", mb);

    memset(c, 0, sz);
  }
  return 0;
}

