feat: Create memory stresser

This commit is contained in:
Louis Gallet 2024-09-13 17:31:34 +02:00
parent 208a583701
commit ed935bba14
Signed by: lgallet
GPG Key ID: 84D3DF1528A84511
2 changed files with 26 additions and 0 deletions

11
Makefile Normal file
View File

@ -0,0 +1,11 @@
CC := gcc
CFLAGS := -Wall -Wextra -Werror -pedantic -std=c99 -g
OBJS := main.o
TARGET := main
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $@ $^
.PHONY: clean
clean:
rm -f $(OBJS) $(TARGET)

15
main.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
int main() {
while (1) {
void* temp = malloc(1024);
*((long int*) temp) = 1024;
if (temp == NULL) {
printf("Memory is full\n");
break;
}
}
return 0;
}