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


#define BLOCK_SIZE (10*1024*1024)


int main(int argc, char *argv[])
{
    unsigned long size = 0;
    char *p;

    while ((p = malloc(BLOCK_SIZE)) != NULL) {
#ifdef DO_MEMSET
        memset(p, 0, BLOCK_SIZE);
#endif
        size += BLOCK_SIZE;
    }

    printf("malloc() returned NULL after %uMB\n", (size/(1024*1024)));

    exit(EXIT_SUCCESS);
}
