This commit is contained in:
2026-05-30 00:12:38 +02:00
commit f93f8d186a
5 changed files with 36 additions and 0 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+36
View File
@@ -0,0 +1,36 @@
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef _WIN32
#include <windows.h>
#define sleep_ms(ms) Sleep(ms)
#else
#include <unistd.h>
#define sleep_ms(ms) usleep((ms) * 1000)
#endif
int MyNum;
int times_iterated;
int main() {
const size_t CHUNK_SIZE = 500 * 1024 * 1024;
size_t total = 0;
while (1) {
void *chunk = malloc(CHUNK_SIZE);
if (!chunk) {
printf("Malloc failed at %zuMB\n", total / 1024 / 1024);
break;
}
memset(chunk, 0xAA, CHUNK_SIZE);
total += CHUNK_SIZE;
printf("Allocated: %zuMB\n", total / 1024 / 1024);
sleep_ms(500);
}
return 0;
}
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.