[LAD] memory leak assistance

Patrick Shirkey pshirkey at boosthardware.com
Tue Dec 29 14:18:11 UTC 2009


Hi,

I have some code in gtk2 that is leaking and I can't fix it. Over the 
past two nights I have managed to get the leak down from 200MB/minute to 
200MB/10 minutes but I can't get rid of it completely. It's annoying 
because it increments in 200MB blocks so I have to wait for up to 10 
mins to see if it is fixed or not. I have tried valgrind but it doesn't 
really like jack and did not give me any useful output. I have traced 
the leak through normal debugging and have verified that it does not 
happen if I disable this offending code.

This code is run in the widgets realize event and the event is triggered 
every 500ms.


   PangoContext *pc = gtk_widget_get_pango_context(widget);
   PangoLayout *pl;
   PangoFontDescription *pfd;
   PangoRectangle rect;

   pfd = pango_font_description_new();
   pango_font_description_set_family(pfd, "sans");
   pango_font_description_set_size(pfd, 8 * PANGO_SCALE);
   pango_context_set_font_description(pc, pfd);
   pl = pango_layout_new(pc);
   pango_layout_set_text(pl, "99", -1);
   pango_layout_get_pixel_extents(pl, &rect, NULL);

   pango_font_description_free(pfd);
   g_object_unref(pc);


If I add another

      g_object_unref(pl) ;


The app code will compile but when I run it I get this segfault:

*** glibc detected *** ./src/jackeq: free(): invalid pointer: 
0x0000000001b87a60 ***


I can have one g_object_unref for either pl or pc without segfaulting 
but not both.


I'm pretty sure this is the last leak I have to catch for the merged 
gtkmeter.c/gtkmeterscale.c and I can't release jackeq until it is fixed. 
Any assistance with this one is appreciated.


Cheers.

-- 
Patrick Shirkey
Boost Hardware Ltd




More information about the Linux-audio-dev mailing list