Re: Memory Leak with pango_layout_new()



On Thu, 2004-09-09 at 17:11 -0400, David Malcolm wrote:
On Thu, 2004-09-09 at 12:31 -0700, martin dempsey wrote:
I've got a major memory leak in an applicaton and I tracked it down to the 
following: if I create a PangoLayout with pango_layout_new() and then use 
pango_layout_set_text(), I get a memory leak even when I try to free the 
memory with g_object_unref(). However, if I replace those function calls with 
a call to gtk_widget_create_pango_layout(), there is no memory leak. The 
memory leak is very obvious: on the real app, I'm losing almost 3 Megabytes 
per hour. "memprof" also very clearly shows the leak. I'm using Debian 
"sarge" and with the standard versions of the gtk development packages for 
that OS. I am pretty new with gtk programming. Am I doing something simple 
wrong?

IIRC, PangoLayouts aren't GObjects; you have to use a different function
to free them.  The call to g_object_unref is failing a type assertion,
spitting a warning out, and doing nothing, hence the leak.

Hmmm... sorry, I remembered incorrectly on this; I just doublechecked
and they are GObjects...




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]