# Memory leak when use decodebin after parsebin

**URL:** <https://discourse.gstreamer.org/t/memory-leak-when-use-decodebin-after-parsebin/1383>\
**Category:** Application Development\
**Tags:** windows\
**Created:** [April 13, 2024, 7:53am UTC](https://discourse.gstreamer.org/t/memory-leak-when-use-decodebin-after-parsebin/1383 "2024-04-13T07:53:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![keivanmoazami](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/keivanmoazami/32/188_2.png) [@keivanmoazami](https://discourse.gstreamer.org/u/keivanmoazami)\
**Post date:** [April 13, 2024, 7:53am UTC](https://discourse.gstreamer.org/t/memory-leak-when-use-decodebin-after-parsebin/1383/1 "2024-04-13T07:53:58Z")

</div>

I want to store non decode video frame for restream it without paying cost of encoding. for this purpose I use urisourcebin → parsebin → decodebin pipeline.  
but when use decodebin after parsebin I get memory leak.  
[Memory Leak Pipeline](https://docs.google.com/document/d/1vWPFbBXab2GIKW-9BgJvSRikjK0GUlJo/edit?usp=drive_link&ouid=112904590669399087741&rtpof=true&sd=true)  
[None Memory Leak Pipeline](https://docs.google.com/document/d/1fCsav_1Tw-PHRbPPYD8uZv35J1n3-vgD/edit?usp=drive_link&ouid=112904590669399087741&rtpof=true&sd=true)  
\*you cane see pipeline with this tools: [Graphviz Online](https://dreampuf.github.io/GraphvizOnline)

I use visual studio memory profiler and bellow image is memory dump difference after some minutes

 ![Untitled2](https://discourse.gstreamer.org/uploads/default/original/1X/b676c19ab447ef39ca88bd0d20a9f7c8b47dd701.jpeg)

Have I done something wrong?  
I want to move tee element after parsebin in “none memory leak” pipeline and do h264depay once. (urisourcebin → parsebin → tee → tee. appsrc - tee. decodebin)  
Thanks

---

<div class="post-metadata">

**Author:** ![tpm](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@tpm](https://discourse.gstreamer.org/u/tpm)\
**Post date:** [April 14, 2024, 2:58pm UTC](https://discourse.gstreamer.org/t/memory-leak-when-use-decodebin-after-parsebin/1383/2 "2024-04-14T14:58:51Z")

</div>

It should be fine to use `decodebin(3)` after `parsebin`.

Can’t really see your pipeline graphs though, putting dot files into google docs isn’t really the best way to present those to us - perhaps you could just turn them into an SVG or PNG and attach that?

---

<div class="post-metadata">

**Author:** ![keivanmoazami](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/keivanmoazami/32/188_2.png) [@keivanmoazami](https://discourse.gstreamer.org/u/keivanmoazami)\
**Post date:** [April 15, 2024, 9:00am UTC](https://discourse.gstreamer.org/t/memory-leak-when-use-decodebin-after-parsebin/1383/3 "2024-04-15T09:00:01Z")

</div>

It’s correct. Using decodebin3 after parsebin doesn’t result in any memory leaks. my gstreamer version is 1.22.5. You can see png file related to the memory leak pipeline below. I need to specify whether the decoding should be done on CPU or GPU, and for that, I need to set the ‘force-sw-decoders’ property for decodebin. However, this property is not available in decodebin3. Is there a way to determine which hardware decodebin3 should use for decoding?

 ![mem_leak](https://discourse.gstreamer.org/uploads/default/original/1X/a4d67db54f027bd5677c2f2d48c19f56811e9e1f.png)

---

<div class="post-metadata">

**Author:** ![tpm](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@tpm](https://discourse.gstreamer.org/u/tpm)\
**Post date:** [April 15, 2024, 12:28pm UTC](https://discourse.gstreamer.org/t/memory-leak-when-use-decodebin-after-parsebin/1383/4 "2024-04-15T12:28:45Z")

</div>

Perhaps you could try a newer version of GStreamer - either the latest 1.22 release or 1.24 even.

There have been a few memory leak fixes in various places.

---

<div class="post-metadata">

**Author:** ![keivanmoazami](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/keivanmoazami/32/188_2.png) [@keivanmoazami](https://discourse.gstreamer.org/u/keivanmoazami)\
**Post date:** [April 15, 2024, 2:15pm UTC](https://discourse.gstreamer.org/t/memory-leak-when-use-decodebin-after-parsebin/1383/5 "2024-04-15T14:15:04Z")

</div>

Yes. in gstreamer 1.24.2 there is no problem  
Thanks
