How to Remove Memory Leak

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to Remove Memory Leak

qwerty-1
Hi All,

I am initializing the GStreaming using gst_init (NULL, NULL) API and then deinit the same using gst_deinit () API.
I run my binary using valgrind and found that Leak Summary of Valgrind showing lot of possibly lost and still reachable in Gstreamer.  Below Sharing the some logs of valgrind:

==31179== 4 bytes in 1 blocks are still reachable in loss record 8 of 1,305
==31179==    at 0x4005E5E: malloc (vg_replace_malloc.c:236)
==31179==    by 0x42A60DC: g_malloc (gmem.c:164)
==31179==    by 0x42BE0FD: g_memdup (gstrfuncs.c:130)
==31179==    by 0x4101D16: g_signal_newv (gsignal.c:1620)
==31179==    by 0x410242B: g_signal_new_valist (gsignal.c:1697)
==31179==    by 0x41025AB: g_signal_new (gsignal.c:1334)
==31179==    by 0x403821C: gst_object_class_intern_init (gstobject.c:202)
==31179==    by 0x410E955: g_type_class_ref (gtype.c:2212)
==31179==    by 0x4035533: init_post (gst.c:670)
==31179==    by 0x42AC3E2: g_option_context_parse (goption.c:1951)
==31179==    by 0x4034FB1: gst_init_check (gst.c:439)
==31179==    by 0x40350E1: gst_init (gst.c:493)
==31179==
==31179== 4 bytes in 1 blocks are still reachable in loss record 9 of 1,305
==31179==    at 0x4005E5E: malloc (vg_replace_malloc.c:236)
==31179==    by 0x42A60DC: g_malloc (gmem.c:164)
==31179==    by 0x42BE0FD: g_memdup (gstrfuncs.c:130)
==31179==    by 0x4101D16: g_signal_newv (gsignal.c:1620)
==31179==    by 0x410242B: g_signal_new_valist (gsignal.c:1697)
==31179==    by 0x41025AB: g_signal_new (gsignal.c:1334)
==31179==    by 0x4038273: gst_object_class_intern_init (gstobject.c:214)
==31179==    by 0x410E955: g_type_class_ref (gtype.c:2212)
==31179==    by 0x4035533: init_post (gst.c:670)
==31179==    by 0x42AC3E2: g_option_context_parse (goption.c:1951)
==31179==    by 0x4034FB1: gst_init_check (gst.c:439)
==31179==    by 0x40350E1: gst_init (gst.c:493)

Please suggest me how to remove above given memory leaks.

Thanks in Advance
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to Remove Memory Leak

Nicolas Dufresne
Le mardi 13 décembre 2011 à 16:43 +0530, Umakant Goyal a écrit :
Hi All,

I am initializing the GStreaming using gst_init (NULL, NULL) API and then deinit the same using gst_deinit () API.
I run my binary using valgrind and found that Leak Summary of Valgrind showing lot of possibly lost and still reachable in Gstreamer.  Below Sharing the some logs of valgrind:
When using valgrind on GStreamer you should add the option --suppressions=gstreamer/common/gst.supp . This file is in the common directory of each Gstreamer repositories (a git submodule). This file contains description of false positives shown by valgrind.

Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to Remove Memory Leak

qwerty-1
I have run the valgrind with option
--suppressions=gstreamer/common/gst.supp. But still valgrind output
showing lot of memory leaks like:

==31550== 100,184 bytes in 21 blocks are possibly lost in loss record
3,352 of 3,355
==31550==    at 0x4005046: memalign (vg_replace_malloc.c:581)
==31550==    by 0x40050A0: posix_memalign (vg_replace_malloc.c:709)
==31550==    by 0x42BAD68: slab_allocator_alloc_chunk (gslice.c:1158)
==31550==    by 0x42BBF2B: g_slice_alloc (gslice.c:684)
==31550==    by 0x42BC0A4: g_slice_alloc0 (gslice.c:854)
==31550==    by 0x410EE46: g_type_create_instance (gtype.c:1865)
==31550==    by 0x40F3A11: g_object_constructor (gobject.c:1615)
==31550==    by 0x40F4281: g_object_newv (gobject.c:1479)
==31550==    by 0x40F4DC4: g_object_new_valist (gobject.c:1596)
==31550==    by 0x40F4EC6: g_object_new (gobject.c:1311)
==31550==    by 0x4055131: gst_element_factory_create (gstelementfactory.c:380)
==31550==    by 0x40564F2: gst_element_factory_make (gstelementfactory.c:451)
==31550==
==31550== 106,080 bytes in 52 blocks are still reachable in loss
record 3,353 of 3,355
==31550==    at 0x4005046: memalign (vg_replace_malloc.c:581)
==31550==    by 0x40050A0: posix_memalign (vg_replace_malloc.c:709)
==31550==    by 0x42BAD68: slab_allocator_alloc_chunk (gslice.c:1158)
==31550==    by 0x42BBF2B: g_slice_alloc (gslice.c:684)
==31550==    by 0x42BC0A4: g_slice_alloc0 (gslice.c:854)
==31550==    by 0x410EE46: g_type_create_instance (gtype.c:1865)
==31550==    by 0x40F3A11: g_object_constructor (gobject.c:1615)
==31550==    by 0x40F4281: g_object_newv (gobject.c:1479)
==31550==    by 0x4088B60: _priv_gst_registry_chunks_load_plugin
(gstregistrychunks.c:559)
==31550==    by 0x40AFE7F: gst_registry_binary_read_cache
(gstregistrybinary.c:600)
==31550==    by 0x4086E33: gst_update_registry (gstregistry.c:1600)

Please Suggest me how to remove this.

Thanks in Advance

On 12/13/11, Nicolas Dufresne <[hidden email]> wrote:

> Le mardi 13 décembre 2011 à 16:43 +0530, Umakant Goyal a écrit :
>
>> Hi All,
>>
>> I am initializing the GStreaming using gst_init (NULL, NULL) API and
>> then deinit the same using gst_deinit () API.
>> I run my binary using valgrind and found that Leak Summary of Valgrind
>> showing lot of possibly lost and still reachable in Gstreamer.  Below
>> Sharing the some logs of valgrind:
>
> When using valgrind on GStreamer you should add the option
> --suppressions=gstreamer/common/gst.supp . This file is in the common
> directory of each Gstreamer repositories (a git submodule). This file
> contains description of false positives shown by valgrind.
>
> Nicolas
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to Remove Memory Leak

Stefan Sauer
On 12/15/2011 12:22 PM, Umakant Goyal wrote:
> I have run the valgrind with option
> --suppressions=gstreamer/common/gst.supp. But still valgrind output
> showing lot of memory leaks like:

Please google a bit. This is an FAQ. Also set these env-vars:
G_SLICE=always-malloc G_DEBUG=gc-friendly
Then understand what a leak is and what a one-time allocation is.

Stefan

> ==31550== 100,184 bytes in 21 blocks are possibly lost in loss record
> 3,352 of 3,355
> ==31550==    at 0x4005046: memalign (vg_replace_malloc.c:581)
> ==31550==    by 0x40050A0: posix_memalign (vg_replace_malloc.c:709)
> ==31550==    by 0x42BAD68: slab_allocator_alloc_chunk (gslice.c:1158)
> ==31550==    by 0x42BBF2B: g_slice_alloc (gslice.c:684)
> ==31550==    by 0x42BC0A4: g_slice_alloc0 (gslice.c:854)
> ==31550==    by 0x410EE46: g_type_create_instance (gtype.c:1865)
> ==31550==    by 0x40F3A11: g_object_constructor (gobject.c:1615)
> ==31550==    by 0x40F4281: g_object_newv (gobject.c:1479)
> ==31550==    by 0x40F4DC4: g_object_new_valist (gobject.c:1596)
> ==31550==    by 0x40F4EC6: g_object_new (gobject.c:1311)
> ==31550==    by 0x4055131: gst_element_factory_create (gstelementfactory.c:380)
> ==31550==    by 0x40564F2: gst_element_factory_make (gstelementfactory.c:451)
> ==31550==
> ==31550== 106,080 bytes in 52 blocks are still reachable in loss
> record 3,353 of 3,355
> ==31550==    at 0x4005046: memalign (vg_replace_malloc.c:581)
> ==31550==    by 0x40050A0: posix_memalign (vg_replace_malloc.c:709)
> ==31550==    by 0x42BAD68: slab_allocator_alloc_chunk (gslice.c:1158)
> ==31550==    by 0x42BBF2B: g_slice_alloc (gslice.c:684)
> ==31550==    by 0x42BC0A4: g_slice_alloc0 (gslice.c:854)
> ==31550==    by 0x410EE46: g_type_create_instance (gtype.c:1865)
> ==31550==    by 0x40F3A11: g_object_constructor (gobject.c:1615)
> ==31550==    by 0x40F4281: g_object_newv (gobject.c:1479)
> ==31550==    by 0x4088B60: _priv_gst_registry_chunks_load_plugin
> (gstregistrychunks.c:559)
> ==31550==    by 0x40AFE7F: gst_registry_binary_read_cache
> (gstregistrybinary.c:600)
> ==31550==    by 0x4086E33: gst_update_registry (gstregistry.c:1600)
>
> Please Suggest me how to remove this.
>
> Thanks in Advance
>
> On 12/13/11, Nicolas Dufresne <[hidden email]> wrote:
>> Le mardi 13 décembre 2011 à 16:43 +0530, Umakant Goyal a écrit :
>>
>>> Hi All,
>>>
>>> I am initializing the GStreaming using gst_init (NULL, NULL) API and
>>> then deinit the same using gst_deinit () API.
>>> I run my binary using valgrind and found that Leak Summary of Valgrind
>>> showing lot of possibly lost and still reachable in Gstreamer.  Below
>>> Sharing the some logs of valgrind:
>> When using valgrind on GStreamer you should add the option
>> --suppressions=gstreamer/common/gst.supp . This file is in the common
>> directory of each Gstreamer repositories (a git submodule). This file
>> contains description of false positives shown by valgrind.
>>
>> Nicolas
>>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel