Subject: bug#76091: 31.0.50; festure/igc: buffer.h:829: Emacs fatal error: assertion failed: BUFFERP (a)

From: Pip Cet <[email-masked]>
Date: Fri, 07 Feb 2025 13:55:19 +0000

Gerd Möllmann <[email-masked]> writes:

> On 7. Feb 2025, at 11:41, Pip Cet <[email-masked]> wrote:
>
>  I have a patch, but I'd like to discuss whether this is a plausible
>  theory first.  Gerd, if there's something that prevents this problem
>  from happening, and I missed it, could you briefly yell at me here?
>
> Good catch!

Thanks!

> I think he idea I had with the igc_on_... is mistaken,

I've rewritten the root resizing functions to always follow the

1. allocate new zeroed root
2. register new root
3. copy contents from old root
4. if this fails, try again
5. save new root
6. unregister old root
7. free old root

pattern.  It's a bit complicated, but avoids the need for parking the
arena in these cases.  And, yes, it'll waste some memory, but these are
roots, and roots are supposed to be small.  I'd rather do it that way
and turn them into non-roots than figure out how to use realloc() on an
MPS root, TBH.

> one must not free the memory of a root while the MPS is not parked.

I think the surprising thing is that parking the arena will cause GC
activity.  It's best to avoid parking it except when walking the pools,
I think.

Still testing the patch...

Pip