From ed935bba14eb6a90a57b70bf8ba97c1ff4680b36 Mon Sep 17 00:00:00 2001 From: Louis Gallet Date: Fri, 13 Sep 2024 17:31:34 +0200 Subject: [PATCH] feat: :sparkles: Create memory stresser --- Makefile | 11 +++++++++++ main.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Makefile create mode 100644 main.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..577bf86 --- /dev/null +++ b/Makefile @@ -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) diff --git a/main.c b/main.c new file mode 100644 index 0000000..5b8fd5c --- /dev/null +++ b/main.c @@ -0,0 +1,15 @@ +#include +#include + +int main() { + while (1) { + void* temp = malloc(1024); + *((long int*) temp) = 1024; + if (temp == NULL) { + printf("Memory is full\n"); + break; + } + + } + return 0; +}