[cairo] Possible Memory Leak Using Glitz Surfaces
David Reveman
c99drn at cs.umu.se
Fri Jul 23 18:23:22 PDT 2004
On Fri, 2004-07-23 at 13:01 -0600, Charles Tuckey wrote:
> More news. We have set up four test systems that all show the memory leak:
> - RedHat 9, NVidia driver 5336
> - RedHat 9, NVidia driver 6106
> - RedHat 9, Ati driver, Mesa 4.0.4 GL libraries
> - RedHat Enterprise 2.1, XiG Summit MX Platinum driver for a Matrox Quad
> G450 card
> All four systems exhibit the leak using the test program. The NVidia
> systems show a leak on the order of tens of megabytes per second. XiG
> system is about 5 megabytes per second and the Ati system is about 1K
> per second.
>
> Through an extremely serendiptious happenstance we found that if we
> added this line of code:
> glitz_texture_fini(gl, src_texture);
> in the _glitz_composite_direct method of glitz.c (diff is below) then
> the memory leak disappers on all four of our test systems.
>
> ***************
> *** 281,286 ****
> --- 281,288 ----
>
> glitz_surface_pop_current (dst);
>
> + glitz_texture_fini(gl, src_texture);
> +
> return 1;
> }
>
> We noticed that new textures were being created but that the
> glitz_texture_fini method was never being called on them. Thus the above
> fix - or hack. Is this the proper way of dealing with this problem?
no, but this helped me find the real problem. It was a bit hard as the
current CVS version of glitz is doing some things a bit smarter, which
meant that this bug wasn't exposed when I was running your test program.
However, this should now be fixed, just get the latest CVS version and
you should be fine.
>
> I admit my knowledge of OpenGL is almost nonexistent. But some questions
> I have are:
> - why do textures get created every time cairo_show_text is called?
they shouldn't as we're using solid colors. this was actually the bug.
> - why do we need textures at all? Won't the default texture do?
yes, you're right. no need for textures when drawing solid colors. the
solid surface's texture target shouldn't even be enabled when drawing
solid colors.
>
> Thanks for your help on this one.
thank you! for finding the problem.
> We still have a memory leak caused by
> GL in our application that is under development but that will require a
> new test program. So, I'll be back. :)
ok, good. please report problems against current CVS version.
just so you know, your test program might still look like it's leaking a
little memory but that's probably due to the fact that opengl drivers
buffer drawing operations and your test program never tells it to flush
them. adding a glitz_surface_swap_buffers call after each
cairo_show_text call, makes system memory usage stable for me.
I've been running your test program with nvidia's 6106 driver.
-David
More information about the cairo
mailing list