shithub: MicroHs

Download patch

ref: 7b429c10bb6f4fdbcda0aa146999839a39844c9b
parent: f88a408d046f019b280b33e07e2cc3c642b41142
author: Lennart Augustsson <lennart@augustsson.net>
date: Wed Jan 1 12:02:13 EST 2025

Better error message when running out of heap when reading the code.

--- a/src/runtime/eval.c
+++ b/src/runtime/eval.c
@@ -1705,6 +1705,8 @@
     case '\n':
       continue;
     }
+    if (num_free < 3)
+      ERR("out of heap reading code");
     GCCHECK(1);
     switch(c) {
     case '@':
@@ -3823,6 +3825,7 @@
     case T_IO_DESERIALIZE:
       CHECKIO(1);
       ptr = (struct BFILE*)evalptr(ARG(TOP(1)));
+      gc();                     /* make sure we have room.  GC during parse is dodgy. */
       n = parse_top(ptr);
       RETIO(n);
 #endif
--