Subject: Re: bug#79023: 30.1.90; Suspicion of memory leak on internal_redisplay (MacOS)

From: Przemysław Alexander Kamiński<[email-masked]>
Date: Mon, 11 Aug 2025 17:15:22 +0200

On Mon, Aug 11, 2025 at 16:36:27 (+0300), Eli Zaretskii wrote:

> This is supposed to cons a list (a Lisp_Object) of relevant fonts,
> which is then reclaimed by GC after face_for_char returns (because
> there are no references to it).  Is that not what happens on macOS?

No, and I think it was designed like that but a bug creeped in.

Function macfont_create_family_with_symbol (macfont.m) uses
symbol-to-font cache, but it seems that cache is set only when pat_desc exists.
Not sure why it's like that, but if that's not on purpose it would
explain why reporting was inconsistent.

I'm not seeing these allocations anymore at all. I started also changing 
ns_can_use_native_image_api function (as it resulted in huge amount of
small allocs). With those two changes I've seen merely 2MiB allocation after my
eshell colorful "fd" listing test - and it seems a legit one (some hook fired).

I need to clean up the code and split patches in smaller ones, hope to
do have that soon.

Best,
Przemysław Alexander Kamiński