Miscellany
public text v1 · immutable#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE (10 * 1024 * 1024)
int
main()
{
int counter = 0;
for ( ; ; ) {
void *p = malloc(SIZE);
if (!p) {
printf("Cannot allocate more memory\n");
return (0);
}
memset(p, 0, SIZE);
counter += SIZE;
printf("Allocated %d bytes\n", counter);
}
return (0);
}