mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
19 lines
335 B
C
19 lines
335 B
C
/* 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;
|
|
}
|
|
}
|
|
}
|