ALGOL 68 Genie - Insufficient memory

137 views Asked by At

I'm doing this simple "game engine" for cli pixel games creation, a68g game engine.
I have seen that in the lib/canvas.a68 file. Those 2 loops are making a error:

7       arr := new
        1
a68g: lib/operators.a68: runtime error: 1: insufficient memory, in VOID closed-clause starting at "(" in line 3.

I tried to remove one of the loops, and the program run normally, regardless of the loop I remove.

Help :)

1

There are 1 answers

0
Panda Soli On

In the words of Marcel van der Veer:

Don’t worry, this is not a bug in a68g, but a peculiarity of Algol 68 implementations. Algol 68 lets you allocate space on the heap, but there is no way you can actively free allocated space as you can in C. Also, a68g m ay keep anonymous intermediate results in the heap. Eventually, heap space is exhausted and a garbage collector must free space that is no longer referred to, and preferably compact the heap.

No garbage collection strategy can solve all memory management issues. Algol 68 Genie has a garbage collector, but since garbage collection is expensive, a68g employs it conservatively as a trade-off to optimize performance. Over the years, this strategy has been tweaked based on user feedback.

On the downside, a few programs may unexpectedly end because the heap fills while from a programmer’s perspective there is no clear reason why that happens. To mitigate this problem, a68g offers two procedures “sweep heap” and “preemptive sweep heap” that you can call at strategic positions in your code, should you need it.