discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memory leak - cairo/x11 backend


From: Riccardo Mottola
Subject: Re: memory leak - cairo/x11 backend
Date: Mon, 16 Dec 2013 12:27:56 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0 SeaMonkey/2.22.1

Eric Wasylishen wrote:

Hi Riccardo,

As a starting point for debugging I would put NSLog's in XGCairoModernSurface -initWithDevice: and -dealloc. This is where we retain / release the Cairo surface that is holding memory in the x server.

Also I would put logging in -NSImage set name:, log [nameDict allKeys] to see which images are kept in memory by nameDict.

In between those two points, NSImage has a NSCachedImageRep which has a GSCacheW (NSWindow subclass). NSWindow retains the Cairo surface though I don't remember exactly how.

Note that if you keep loading different images, we currently have no facility for releasing old NSImages from nameDict, so once an image is cached we never release it. This should be a fairly easy thing to fix by turning it in to a proper cache with some eviction policy and size estimation per NSImage.

But anyway, if you switch back and forth between two images it shouldn't leak, so there is a bug somewhere.

Well, I don't switch back and forth between two images, but am viewing a film roll, so e.g. 36 images. So if they all remain cached, this can explain the increase.

If they are cached however,t hen perhaps they should load faster thnan they do.

Are you implying that if we just continue to load images we throw them into the server without never releasing until we quit an application? For an application that runs long that ould mean eating up a lot of ram, even with many small images!

Riccardo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]