Files
linux-kernel-module-cheat/userland/c/out_of_memory.c
Ciro Santilli 六四事件 法轮功 05aa5c7c79 baremetal: build userland/ programs using baremetal path property instead of symlinks
Otherwise I'll go crazy with symlink action.
2019-05-24 00:00:00 +00:00

19 lines
345 B
C

/* Let's see how much memory Linux lets us allocate. */
#include <stdio.h>
#include <stdlib.h>
int main(void) {
char *ptr = NULL;
size_t size = 1;
while (1) {
printf("0x%zx\n", size);
ptr = realloc(ptr, size);
if (ptr == NULL) {
break;
} else {
size <<= 1;
}
}
}