Re: Release planning for 0.14.2
Uli Schlachter <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Hi, Am 08.03.2015 um 01:38 schrieb Cedric Roux: > On 03/07/2015 11:19 PM, Henry (Yu) Song wrote: >> I will re-work on this. There is a memory leak in caio_surface_flush >> () in xlib surface. Observed that 5000 cairo_surface_flush () calls >> leaks about 2 MB. At least the trivial case does not leak (See attachment, valgrind only complains about pixman choosing an implementation). >> Thanks for feedback > > I had something similar a few months ago. > I was using XCheckMaskEvent. > Rewriting the program to use XNextEvent solved the issue. > See: http://lists.cairographics.org/archives/cairo/2013-December/024819.html > > In my case, the problem was that XCheckMaskEvent will not pick up > MIT-SHM-Completion events, so they will accumulate in the queue > (if I get it right). > > So the "solution" is to use XNextEvent, which will pick up those > unwanted events. An app that has a memleak if it gets an unexpected event? That sounds like a bug in that application. For example, does it handle KeymapNotify events? And I bet there are other events that would stay in the event queue. > Or fix cairo, because those events have nothing > to do in the X queue in the first place. It might be hard though... As far as I know, this is not going to happen since Xlib won't let you do that. Also, cairo would need to tell apart "its own events" and events from other users of the SHM extension. Cheers, Uli -- "For saving the Earth.. and eating cheesecake!" -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo
test.c
(text/x-csrc, 382 B)
#include <cairo-xlib.h>
int main()
{
int i;
Display *dpy = XOpenDisplay(NULL);
int s = DefaultScreen(dpy);
cairo_surface_t *surf = cairo_xlib_surface_create(dpy, RootWindow(dpy, s),
DefaultVisual(dpy, s), DisplayWidth(dpy, s), DisplayHeight(dpy, s));
for (i = 0; i < 5000; i++)
cairo_surface_flush(surf);
cairo_surface_destroy(surf);
XCloseDisplay(dpy);
return 0;
}