init
This commit is contained in:
Binary file not shown.
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user