memprof and GTK/GNOME functions



Hi Owen,

Just tried your MemProf utility and had some questions/comments.  Upon
using MemProf with my GTK/GNOME application, MemProf found two leaks
in my code: one with gtk_style_new(), and one in my routine.  I don't
think gtk_style_new() is at fault, but here are the code snippets for
both cases:

  [1]
	style = gtk_style_new();	/* MemProf points at this line */
	gtk_widget_set_style(GTK_WIDGET(d->data), style);
	gtk_widget_set_rc_style(GTK_WIDGET(d->data));
	gtk_widget_ensure_style(GTK_WIDGET(d->data));

  [2]
	GnomeUIInfo *menuitem;

	menuitem = g_new0(GnomeUIInfo, 2);	/* MemProf points here */
	... [ filling in fields for menuitem ] ...
	gnome_app_insert_menus_with_data(GNOME_APP(w->toplev),
					 path, menuitem, data);


So a general question: how accurate is MemProf?

A general comment: from looking at the API, and even doing cursory
inspections of the GTK and GNOME code, it's not apparent that what my
code is doing up above is considered a memory leak.

Does MemProf know something that I don't about GTK and GNOME?

Both of the "leaks" I mentioned above were fixed(?).  The first by
calling gtk_style_unref(), and the second by freeing the variable
"menuitem".  There doesn't appear to be any problems with my
application after doing this, but is there some way to be sure?

Overall, aside from the lack of documentation for GTK/GNOME (there's
that old problem again), MemProf seems to be a fairly useful tool.

regards,
--andy



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