[Bug 681913] gst_init_check cause memory leak

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Wed Aug 15 07:33:19 PDT 2012


https://bugzilla.gnome.org/show_bug.cgi?id=681913
  GStreamer | gstreamer (core) | 0.10.36

Tim-Philipp Müller <t.i.m> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |NOTABUG
   Target Milestone|HEAD                        |NONE

--- Comment #3 from Tim-Philipp Müller <t.i.m at zen.co.uk> 2012-08-15 14:33:16 UTC ---
This appears to be an intentional leak inside GLib.


/* HOLDS: g_quark_global_lock */
static inline GQuark
g_quark_new (gchar *string)
{
  GQuark quark;
  gchar **g_quarks_new;

  if (g_quark_seq_id % G_QUARK_BLOCK_SIZE == 0)
    {
      g_quarks_new = g_new (gchar*, g_quark_seq_id + G_QUARK_BLOCK_SIZE);
      if (g_quark_seq_id != 0)
    memcpy (g_quarks_new, g_quarks, sizeof (char *) * g_quark_seq_id);
      memset (g_quarks_new + g_quark_seq_id, 0, sizeof (char *) *
G_QUARK_BLOCK_SIZE);
      /* This leaks the old quarks array. Its unfortunate, but it allows
     us to do lockless lookup of the arrays, and there shouldn't be that
     many quarks in an app */
      g_atomic_pointer_set (&g_quarks, g_quarks_new);
    }
  if (!g_quark_ht)
    {
      g_assert (g_quark_seq_id == 0);
      g_quark_ht = g_hash_table_new (g_str_hash, g_str_equal);
      g_quarks[g_quark_seq_id] = NULL;
      g_atomic_int_inc (&g_quark_seq_id);
    }

  quark = g_quark_seq_id;
  g_atomic_pointer_set (&g_quarks[quark], string);
  g_hash_table_insert (g_quark_ht, string, GUINT_TO_POINTER (quark));
  g_atomic_int_inc (&g_quark_seq_id);

  return quark;
}


Feel free to move this to GLib and re-open it, but it does look intentional..

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list