aboutsummaryrefslogtreecommitdiff
path: root/tests/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mem.c')
-rw-r--r--tests/mem.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/mem.c b/tests/mem.c
new file mode 100644
index 0000000..36ad3a9
--- /dev/null
+++ b/tests/mem.c
@@ -0,0 +1,15 @@
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* mem.c -- Exhaust your memory */
+int main(void){
+ void *ptr = NULL;
+ unsigned long mb = 1;
+ for (;;mb++) {
+ fprintf(stderr, "%lu MB\n", mb);
+ if ((ptr = realloc(ptr, mb * 1000000)) == NULL) {
+ raise(SIGABRT);
+ }
+ }
+}