1 #!/usr/local/bin/rune -x
3 # Test heap storage. Rune does not garbage collect loops... that is
4 # considered a run time error (which we will eventually detect). Rune
5 # will track references and delete heap objects recursively. It is
6 # recommended that you not rely on this for long singly-linked lists
7 # because you may run out of stack. Intead you should NULL the next
8 # pointer out manually.
10 # This example defaults to recursively cleaning up after your list.
11 # If you change the 'i' loop to go to, say, 100000, and the (i == 30)
12 # to be (i == 80000), you may see the stack overflow.
17 alias stdio.File *stdout = stdio.stdout;
25 main(int ac, char **av)
30 for (i = 0; i < 1000000; ++i) {
41 global Test **last = &base;
47 if (item->index > 50000) {
50 if (item->index % 10000 == 0)
51 stdout->show(item->index, (int)(item - base));