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: Eric Wasylishen
Subject: Re: memory leak - cairo/x11 backend
Date: Sun, 15 Dec 2013 12:21:22 -0700

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.

Cheers
Eric

On Dec 15, 2013 4:47 AM, "Riccardo Mottola" <riccardo.mottola@libero.it> wrote:
Hi,

testing stuff before "release" as Fred asked gets me to this (I think this problem has been around since a while, it just happened that yesterday I stressed everything with very big files). A couple of weeks ago I had my image viewer crash under OpenBSD on an older Laptop, but I didn't consider that back then.

1) Use current LaternaMagica
2) load very big images (e.g.30/40 MPixels) and view them back and forth
3) check memory

What you will notice is that while LaternaMagica stays about constant in memory requirements, the memory allocated to Xorg grows and grows (I got it here in the 1-2G range, on older system it crashes).

I suppose we cache our images in the X server and do not release them well, in this case they are very big and it becomes apparent.
If LM is closed regulary, most of the Xorg RAM will be freed again.

I don't know where the fault is, but I suppose it shouldn't be in LaternaMagica itself, since I the application ram doesn't increase much.
I tried to do the same on my Mac and everything works fine, further supporting that it is not LM itself.

I will try with xlib and art backends.

Riccardo

_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

reply via email to

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