Your task is to write a program that:
- Runs indefinitely
- Produces no output
- Consumes an unbounded amount of memory
Specifications
- You must list the implementation used for your program. This is relevant because some implementations might preform optimizations while others do not. For example, the LISP code
(defun f () (f)) (f)
may or may not consume infinite memory depending on whether the implementation optimizes tail recursion. - Obviously, your program may terminate from running out of memory.
Examples
BF:
+[>+]
Python:
l = []
while True:
l.append(1)
JavaScript:
l = [];
while (true)
l.push(1);
C (I'm not sure if this works):
#include <stdio.h>
int main() {
while (1)
malloc(1);
}
This is code-golf, so the shortest valid solution (in bytes) wins.
malloc
is instdlib.h
, notstdio.h
. \$\endgroup\$<stdlib.h>
by default. \$\endgroup\$stdlib.h
transitively viastdio.h
. That doesn't mean they includestdlib.h
by default. \$\endgroup\$