Subject: bug#75636: GTK memory leaks

From: Pip Cet <[email-masked]>
Date: Fri, 17 Jan 2025 20:15:02 +0000

Creating and destroying GTK frames (using gtkutil.c, not PGTK) currently
leaks some memory, particularly when using tool bars.

1. The input "multicontext" created by:

  imc = gtk_im_multicontext_new ();
  g_object_ref (imc);

is only unref'd once when destroying the frame.  This leaves the
refcount at 1 and leaks the object.

2. free_frame_tool_bar is never called in my experiments, so the toolbar
widget isn't destroyed.

This isn't usually a problem because it's just a small memory leak, but
on the feature/igc branch, user data passed to glib must be protected in
a special GC root structure; such structures accumulate when running in
GTK, eventually reducing GC performance significantly.

Unfortunately, valgrind doesn't seem to catch these memory leaks.