ALGOL 68 Genie - 内存不足

标签 algol algol68

我正在为 cli 像素游戏创建做这个简单的“游戏引擎”, a68g game engine
我在 lib/canvas.a68 文件中看到了这一点。这两个循环出错了:

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

我尝试删除其中一个循环,并且无论我删除哪个循环,程序都会正常运行。

帮助:)

最佳答案

the words 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.

关于ALGOL 68 Genie - 内存不足,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73751326/

相关文章:

language-agnostic - 195 0's and 1960' s 语言的编译器

c - C 运算符/\和\/做了什么?

algorithm - 通缉 : working Bose-Hibbard Sort implementation preferably in C-like language

knuth - "Man Or Boy"Knuth 测试如何进行?

c - Algol 和 C 在类型转换中的语义差异

c++ - 如何将 Algol 68 Genia 语言转换为 C++ 语言