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

From: Przemysław Alexander Kamiński<[email-masked]>
Date: Thu, 17 Jul 2025 17:02:11 +0200

On 17 Jul 2025, at 16:37, Alan Third wrote:

> On Thu, Jul 17, 2025 at 03:34:51PM +0200, Przemysław Alexander 
> Kamiński wrote:
> It could be worth looking into whether we're releasing IOSurface's
> correctly. I've had a look and the code looks OK to me, but I'm not an
> expert on their use.

It's definitelly fine. Objects are released and are hefty but there are 
only few allocations.

I done the stupidest fix possible. I put 0.1 sleep in 
layoutSublayersOfLayer and then 0.05 sleep for windowWillResize.

Resizing is not so smooth but:
- Number of allocations dropped considerably
- Instance, after furious resizing, sits at 263MiB instead of 1.6GiB

I saw some allocations still going, so investigated and... tracing 
process.
It looks like with slowed down redrawing it can reuse object pool 
without expanding it and keeping overal memory low.

I ran this instance with my config and it properly shrinks memory usage 
while sitting at 500MiB of stable usage. On top of it - memory usage 
seems to get back to baseline after further resizing. I'm going to build 
it with all the libs/flags I use usually and run it for some time to see 
if there aren't any issues with it.

Best,
Przemysław Alexander Kamiński