From 872aea5725559cbed6dd268032ea039f9f33e831 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 22 Jan 2023 16:21:13 -0800 Subject: bugfix: gc issue in parser interface. * parser.c (lisp_parse_impl): Add a call to gc_hint, to protect the parser object from garbage collection. We allocate this object, and then use a raw pointer to the parser, which leaves it exposed. This resulted in a crash of the tests/010/json.tl test case (which runs with the --gc-debug mode). The crash doesn't occur in a regular build; it reproduced in build configured with --no-gen-gc. Possibly, why it doesn't repro under generational GC is that the hash table which associates streams and parsers may be moving the objects into the mature generation. --- parser.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parser.c b/parser.c index 8ee4bf8e..c61b2875 100644 --- a/parser.c +++ b/parser.c @@ -782,6 +782,8 @@ static val lisp_parse_impl(val self, enum prime_parser prime, return error_return_val; } + gc_hint(parser); + return pi->syntax_tree; } -- cgit v1.2.3