Samples/14_multivideo_decode: when decode 24 videos at same time, the memory usage will increase along with the time

I’m testing the NVIDIA-Xavier-NX video decoder, as follow step:

  1. cd /usr/src/jetson_multimedia_api/samples/14_multivideo_decode/
  2. make
  3. copy a video file test2.h264 (resolution=1920x1080 & fps=25 & duration=47min) to currently directory
  4. ./multivideo_decode num_files 24 ./test2.h264 H264 ./test2.h264 H264 …(repeat 21 times)… ./test2.h264 H264 --disable-rendering --stats –input-nalu
  5. and open another terminate, use jtop watch the CPU/GPU memory usage:
    Time CPU-mem / GPU-mem
    11:32:00 791.2 MB / 2.4 GB
    11:35:27 800.1 MB / 2.4 GB
    11:40:00 815.0 MB / 2.4 GB
    11:44:40 828.1 MB / 2.4 GB
    11:48:00 837.3 MB / 2.4 GB
    I found the CPU-mem increases always.
    And then, I replace –input-nalu with –input-chunks parameter, take a second test:
    Time CPU-mem / GPU-mem
    11:51:30 730.8 MB / 2.4 GB
    11:53:30 741.0 MB / 2.4 GB
    11:55:30 744.5 MB / 2.4 GB
    11:56:30 740.5 MB / 2.4 GB
    11:57:30 742.7 MB / 2.4 GB
    11:58:30 740.6 MB / 2.4 GB
    11:59:30 745.8 MB / 2.4 GB
    12:00:30 750.4 MB / 2.4 GB
    12:01:30 750.2 MB / 2.4 GB
    12:03:30 752.4 MB / 2.4 GB
    12:04:30 752.5 MB / 2.4 GB
    12:05:30 752.2 MB / 2.4 GB
    12:06:30 751.3 MB / 2.4 GB
    12:07:30 751.9 MB / 2.4 GB
    12:11:30 752.4 MB / 2.4 GB
    12:16:30 751.8 MB / 2.4 GB
    As above test results, the CPU-mem was stable at least.
    What’s wrong with my test? Anyone can help me?

Hi,
Please apply this and try again:
Memory Leak (Alloc/free mismatch) in Tegra multimedia API (encoder) - #6 by DaneLLL

And another possibility is the memory is cached. Please also try
How to Clear RAM Memory Cache, Buffer, and Swap on Linux

@DaneLLL Thanks for your reply.
My OS information is : Jetpack 4.4.1 [L4T 32.4.4]
nvidia-l4t-kernel 4.9.140-tegra-32.4.4-20201016123640
nvidia-l4t-multimedia 32.4.4-20201016123640
nvidia-l4t-multimedia-utils 32.4.4-20201016123640

I can not find /usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so on my machine, but found /usr/lib/aarch64-linux-gnu/tegra/libnvargus.so

Finally, I reboot the system as follow step:

  1. reboot
  2. echo 3 >/proc/sys/vm/drop_caches
  3. run the 24-videos test with –input-nalu
  4. watch jtop and top memory usage:
    Time CPU-mem / GPU-mem top-command-pid
    15:42:30 730.5 MB / 2.4 GB RES 320416 KB
    15:44:30 737.7 MB / 2.4 GB RES 321504 KB
    15:46:30 742.9 MB / 2.4 GB RES 327840 KB
    15:48:30 752.0 MB / 2.4 GB RES 334808 KB
    15:50:30 757.8 MB / 2.4 GB RES 341144 KB
    15:53:30 767.0 MB / 2.4 GB RES 348500 KB

You can see the problem was reproduced.

Hi,
Are you able to upgrade to latest Jetpack 4.6 and try?

In fact, I downloaded 4 packages from Index,
nvidia-l4t-core_32.6.1-20210726122859_arm64.deb
nvidia-l4t-jetson-multimedia-api_32.6.1-20210916210945_arm64.deb
nvidia-l4t-multimedia_32.6.1-20210916210945_arm64.deb
nvidia-l4t-multimedia-utils_32.6.1-20210916210945_arm64.deb

  1. and use dpkg -x xxxx.deb ./nvidia-l4t_32.6.1/ extract the so files
  2. cd ./nvidia-l4t_32.6.1/usr/src/jetson_multimedia_api/samples/14_multivideo_decode/
  3. edit …/Rules.mk , set the TARGET_ROOTFS := /home/ubuntu/nvidia-l4t_32.6.1
  4. make
  5. export LD_LIBRARY_PATH=.:/home/ubuntu/nvidia-l4t_32.6.1/usr/lib/aarch64-linux-gnu:/home/ubuntu/nvidia-l4t_32.6.1/usr/lib/aarch64-linux-gnu/tegra
  6. run 24-videos test again
  7. I found the memory is still increase.

Hi,
If your system image is Jetpack 4.4.1, you should install and run samples in the same version. We would suggest reflash system image to 4.6 and install SDK components through SDKManager. Would be great if you can use latest release.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.