Subject: bug#75477: 31.0.50; scratch/igc: crash on the latest commit

From: Pip Cet <[email-masked]>
Date: Fri, 10 Jan 2025 15:50:19 +0000

"Ihor Radchenko" <[email-masked]> writes:

> Gerd Möllmann <[email-masked]> writes:
>
>> Don't know if that helps, but M-x igc-root-stats can be used to display
>> information about known roots. Maybe one can see there if the number of
>> roots increases over time, which would indicate if there is something
>> like a "root leak", for example by using xfree instead of igc_xfree.
>
> I noticed that creating a new frame took longer and longer over time
> recently. Up to a dozen of seconds.

Thanks! Trying to reproduce that here with:

./src/emacs -Q --eval '(run-with-timer 1.0 1.0 (lambda () (delete-frame (make-frame))))'

indicates 8 xzalloc-ambig roots apparently leaked per frame created
(after the fix I just pushed).  Ouch.  Even if we xfree() those, that's
a great number of heap words incorrectly declared to be ambiguous roots,
which may hide other bugs.

No apparent leak with --with-x-toolkit=no, so we know where to look.

Maybe we should move to a new bug for that?  I think xfree should check
it is not called on an IGC root, and we may want to record the __LINE__
where igc_xzalloc_ambig is called.

Pip