20 lines
521 B
C
20 lines
521 B
C
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
#define CHUNK 4194304 // 4 MB
|
|
|
|
int main()
|
|
{
|
|
printf("Welcome to memeater! This little program is designed to eat up all the memory on your system.\n");
|
|
sleep(1);
|
|
void* allocated = malloc(CHUNK);
|
|
do {
|
|
printf("Allocating 4 MB of memory... %lx\n", (unsigned long)allocated);
|
|
sleep(1);
|
|
} while ((allocated = malloc(CHUNK)));
|
|
perror("malloc");
|
|
printf("Press any key to restart.\n");
|
|
} |