GNOME Bugzilla – Bug 133339
registry/gst_structure_from_string() leaks memory
Last modified: 2004-12-22 21:47:04 UTC
GStreamer seems to leak memory when the registry is read in, as the following program shows: int main (int argc, char **argv) { gst_init(&argc, &argv); return 0; } gst_structure_from_string()/_gst_caps_from_string_inplace() seem to be the major culprits. Here is the valgrind output: ==11223== ERROR SUMMARY: 77 errors from 3 contexts (suppressed: 22 from 3) ==11223== malloc/free: in use at exit: 1362361 bytes in 8530 blocks. ==11223== malloc/free: 82200 allocs, 73670 frees, 3529506 bytes allocated. ==11223== For counts of detected errors, rerun with: -v ==11223== searching for pointers to 8530 not-freed blocks. ==11223== checked 8046132 bytes. ==11223== ==11223== ==11223== 36 bytes in 1 blocks are definitely lost in loss record 2 of 12 ==11223== at 0x4002CBEE: malloc (vg_replace_malloc.c:160) ==11223== by 0x4062E508: nss_parse_service_list (nsswitch.c:529) ==11223== by 0x4062DD78: __GI___nss_database_lookup (nsswitch.c:133) ==11223== by 0x4252436B: ??? ==11223== by 0x42525F08: ??? ==11223== by 0x405EE025: getpwuid_r@@GLIBC_2.1.2 (getXXbyYY_r.c:219) ==11223== by 0x405205BF: g_get_any_init (gutils.c:829) ==11223== by 0x40520A47: g_get_home_dir (gutils.c:962) ==11223== by 0x4025E7A4: init_pre (gst.c:444) ==11223== by 0x4025F1FB: init_popt_callback (gst.c:662) ==11223== ==11223== ==11223== 800 bytes in 20 blocks are possibly lost in loss record 6 of 12 ==11223== at 0x4002D685: calloc (vg_replace_malloc.c:201) ==11223== by 0x405081C2: g_malloc0 (gmem.c:153) ==11223== by 0x403728CB: type_node_any_new_W (gtype.c:290) ==11223== by 0x40372BB4: type_node_fundamental_new_W (gtype.c:392) ==11223== by 0x40379020: g_type_init_with_debug_flags (gtype.c:3053) ==11223== by 0x40379149: g_type_init (gtype.c:3111) ==11223== by 0x4025E6B7: init_pre (gst.c:389) ==11223== by 0x4025F1FB: init_popt_callback (gst.c:662) ==11223== by 0x4067B641: (within /lib/libpopt.so.0.0.0) ==11223== by 0x4067B64F: (within /lib/libpopt.so.0.0.0) ==11223== ==11223== ==11223== 49726 bytes in 35 blocks are possibly lost in loss record 8 of 12 ==11223== at 0x4002CBEE: malloc (vg_replace_malloc.c:160) ==11223== by 0x40508161: g_malloc (gmem.c:136) ==11223== by 0x40513D04: g_strdup (gstrfuncs.c:91) ==11223== by 0x402936AC: gst_structure_from_string (gststructure.c:1346) ==11223== by 0x40268B18: _gst_caps_from_string_inplace (gstcaps.c:1080) ==11223== by 0x40268C2C: gst_caps_from_string (gstcaps.c:1117) ==11223== by 0x402AB1B1: gst_xml_registry_parse_padtemplate (gstxmlregistry.c:844) ==11223== by 0x402AB818: gst_xml_registry_text (gstxmlregistry.c:1004) ==11223== by 0x405076EC: g_markup_parse_context_parse (gmarkup.c:1372) ==11223== by 0x402AA629: gst_xml_registry_load (gstxmlregistry.c:602) ==11223== ==11223== ==11223== 850111 bytes in 980 blocks are definitely lost in loss record 12 of 12 ==11223== at 0x4002CBEE: malloc (vg_replace_malloc.c:160) ==11223== by 0x40508161: g_malloc (gmem.c:136) ==11223== by 0x40513D04: g_strdup (gstrfuncs.c:91) ==11223== by 0x402936AC: gst_structure_from_string (gststructure.c:1346) ==11223== by 0x40268B93: _gst_caps_from_string_inplace (gstcaps.c:1089) ==11223== by 0x40268C2C: gst_caps_from_string (gstcaps.c:1117) ==11223== by 0x402AB1B1: gst_xml_registry_parse_padtemplate (gstxmlregistry.c:844) ==11223== by 0x402AB818: gst_xml_registry_text (gstxmlregistry.c:1004) ==11223== by 0x405076EC: g_markup_parse_context_parse (gmarkup.c:1372) ==11223== by 0x402AA629: gst_xml_registry_load (gstxmlregistry.c:602) ==11223== ==11223== LEAK SUMMARY: ==11223== definitely lost: 850147 bytes in 981 blocks. ==11223== possibly lost: 50526 bytes in 55 blocks. ==11223== still reachable: 461488 bytes in 7493 blocks. ==11223== suppressed: 200 bytes in 1 blocks. ==11223== Reachable blocks (those to which a pointer was found) are not shown. Cheers -Tim
This has been fixed in CVS. Thanks. 2004-02-03 Benjamin Otte <in7y118@public.uni-hamburg.de> * gst/gststructure.c: (gst_structure_from_string): fix huge memleak * gst/elements/gsttypefind.c: (gst_type_find_element_have_type), (new_entry), (gst_type_find_element_chain): * gst/gstelement.c: (gst_element_base_class_init), (gst_element_class_set_details): * gst/gstpad.c: (gst_pad_can_link_filtered): fix smaller memleaks * gst/gstpad.c: (gst_real_pad_dispose): check that explicit caps are gone * gst/gststructure.c: (gst_structure_free): actually free the structure Cheers -Tim