[cairo] Possible Memory Leak Using Glitz Surfaces

David Reveman c99drn at cs.umu.se
Wed Jul 21 07:17:44 PDT 2004


On Tue, 2004-07-20 at 17:27 -0600, Charles Tuckey wrote:
> Hi,
> 
> I have found an extremely large memory leak that occurs when using cairo 
> with glitz surfaces. I have attached a very simple program that 
> demonstrates the leak. I've run the program (and demonstrated the leak) 
> against two different video cards: one is an NVidia card using the 
> latest NVidia driver and the other is a Matrox card using an Xi Graphics 
> driver. The NVidia card is on a RedHat 9 system and the Matrox card is 
> on a Redhat Enterprise 2.1 system.
> 
> The leak does not occur using pixman surfaces. Also, if the glitz 
> surfaces are destroyed after each use, instead of using the same glitz 
> surface all the time, the leak slows down by several orders of magnitude 
> but is still quite noticeable.
> 
> I used valgrind to try and track down the source of the leak on the 
> NVidia system. It does not appear to be in either cairo or glitz but in 
> the GL driver supplied by NVidia for the video card. This makes me 
> wonder if it is in fact a leak, or if I am using glitz incorrectly.
> 
> Any help or advice on this issue would be appreciated.

ok, I looked at your test program and there are some minor problems.

You shouldn't use XCreateSimpleWindow to create windows for GLX
rendering. You must first find a valid visual and then use that visual
to create the window. glitz_glx_find_standard_format will find a valid
visual for you, just use glitz_glx_get_visual_info_from_format to get a
pointer to a XVisualInfo structure which you can use to create the
window. I've attached a patch for this.

It's not impossible that this is somehow related to your memory leak.
Running your test program with software mesa shows no memory leak.
 
-David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: memleak_test.c.diff
Type: text/x-patch
Size: 1589 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20040721/83491c22/memleak_test.c.bin


More information about the cairo mailing list