mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-28 20:44:26 +01:00
baremetal: symlink all programs that currently run on both userland and baremetal
This commit is contained in:
18
baremetal/out_of_memory.c
Normal file
18
baremetal/out_of_memory.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/* Test out of memory. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
char *ptr = NULL;
|
||||
size_t alloc_size = 1;
|
||||
while (1) {
|
||||
ptr = realloc(ptr, alloc_size);
|
||||
if (ptr == NULL) {
|
||||
puts("out of memory");
|
||||
break;
|
||||
} else {
|
||||
alloc_size <<= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user