GNU bug report logs -
#74547
31.0.50; igc: assertion failed in buffer.c
Previous Next
Reported by: Óscar Fuentes <oscarfv <at> telefonica.net>
Date: Tue, 26 Nov 2024 18:36:02 UTC
Severity: normal
Found in version 31.0.50
Done: Óscar Fuentes <oscarfv <at> telefonica.net>
Bug is archived. No further changes may be made.
Full log
Message #41 received at 74547 <at> debbugs.gnu.org (full text, mbox):
Pip Cet <pipcet <at> protonmail.com> writes:
> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>
>> Pip Cet <pipcet <at> protonmail.com> writes:
>
>>> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>>>> Pip Cet <pipcet <at> protonmail.com> writes:
>>>> Yes, exactly, json.c. First thing I saw when searching for xfree
>>>>
>>>> static void
>>>> json_parser_done (void *parser)
>>>> {
>>>> struct json_parser *p = (struct json_parser *) parser;
>>>> if (p->object_workspace != p->internal_object_workspace)
>>>> xfree (p->object_workspace);
>>>>
>>>> That at least needs an explanation. I would have expected it to be
>>>> allocated as root.
>>>
>>> Well, the explanation is this comment:
>>>
>>> /* Lisp_Objects are collected in this area during object/array
>>> parsing. To avoid allocations, initially
>>> internal_object_workspace is used. If it runs out of space then
>>> we switch to allocated space. Important note: with this design,
>>> GC must not run during JSON parsing, otherwise Lisp_Objects in
>>> the workspace may get incorrectly collected. */
>>
>> That explains it, indeed :-(.
>
> Just to be clear, I think the mixed heap/stack allocation is the right
> thing to do here, but we need to let both garbage collectors know about
> the Lisp_Objects we allocated.
>
> I think the best way to do that is to use a Lisp_Vector when we run out
> of stack space. That way, we don't have to worry about forgetting to GC
> it, and we can use standard functions rather than rolling our own.
Yeah, I'd prefer using Lisp_Vectors too, and it was actually implemented
at some point, but removed again, see
https://yhetil.org/emacs-devel/87edc1rzig.fsf <at> gmail.com/
I vaguely remember a longer thread about GC in json.c at the time. Could
be that that was before igc became a realistic possibility, don't
remember.
And yes, I've forgotten about it, and should actually have fixed this
long ago :-).
This bug report was last modified 155 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.