DeepStream SDK FAQ

Fix for a memory accumulation bug in GstBaseParse
A memory accumulation bug was found in GStreamer’s Base Parse class which potentially affects all codec parsers provided by GStreamer. This bug is seen only with long duration seekable streams (mostly containerized files e.g. mp4). This does not affect live sources like RTSP. We have filed an issue on GStreamer’s gitlab project (gstbaseparse: High memory usage in association index for long duration files (#468) · Issues · GStreamer / gstreamer · GitLab).

Temporary fix

  1. Check the exact gstreamer version installed on the system.

$ gst-inspect-1.0 --version

gst-inspect-1.0 version 1.14.5

GStreamer 1.14.5

  1. Clone the Gstreamer repo and checkout the tag corresponding to the installed version

$ git clone

$ cd gstreamer

$ git checkout 1.14.5

  1. Make sure build dependencies are installed

$ sudo apt install libbison-dev build-essential flex debhelper

  1. Run and configure script

$ ./ –noconfigure

$ ./configure –prefix=$(pwd)/out # Don’t want to overwrite system libs

  1. Save the following patch to a file
diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c
index 41adf130e..ffc662a45 100644
--- a/libs/gst/base/gstbaseparse.c
+++ b/libs/gst/base/gstbaseparse.c
@@ -1906,6 +1906,9 @@ gst_base_parse_add_index_entry (GstBaseParse * parse, guint64 offset,
   GST_LOG_OBJECT (parse, "Adding key=%d index entry %" GST_TIME_FORMAT
       " @ offset 0x%08" G_GINT64_MODIFIER "x", key, GST_TIME_ARGS (ts), offset);
+  if (!key)
+    goto exit;
   if (G_LIKELY (!force)) {
     if (!parse->priv->upstream_seekable) {
  1. Apply the patch

$ cat patch.txt | patch -p1

  1. Build the sources

$ make -j$(nproc) && make install

  1. Backup the distribution provided library and copy the newly built library. Adjust the library name for version. For jetson replace x86_64-linux-gnu with aarch64-linux-gnu

$ sudo cp /usr/lib/x86_64-linux-gnu/ ${HOME}/

$ sudo cp out/lib/ /usr/lib/x86_64-linux-gnu/