AnsweredAssumed Answered

i.MX6DP VPU driver leaks memory on application crash

Question asked by Rostyslav Khudolii on Jan 24, 2020
Latest reply on Jan 26, 2020 by igorpadykov

Hi all,


We're using the VPU for video decoding and discovered an interesting problem(s).

Let's say we have an App1 and App2, both are using libimxvpuapi to decode video frames. Consider the following scenario:

  1. App1 starts, initializes and waits for the frames to decode;
  2. App2 starts, initializes and waits for the frames to decode;
  3. Encoded frames arrive in the App2, it successfully decodes them and then terminates abnormally (crashes);
  4. Repeat step 2

After some time the App2 will fail to allocate memory to decode frames with the following messages:

mxc_vpu 2040000.vpu_fsl: Physical memory allocation error!


After a quick look at the VPU driver source code (drivers/mxc/mxc_vpu.c) we figured that this happens because all the allocated memory is freed only when there're no references to the /dev/mxc_vpu file (basically on the last call to vpu_release()). This means that when the App2 crashes - the memory, that was allocated for it, isn't released. Hence we have a memory leak.


Therefore I've got a couple of questions:

  1. Is this desired behaviour?
  2. If not, are there any bugfixes planned to address this issue?
  3. Any workarounds you can suggest?


Hardware used:

A custom i.MX6DP-based board.


Software used:

imx-vpu 5.4.38

Linux Kernel 4.9.11


The latest BSP that is based on 4.14.98 Linux Kernel has the same vpu_release() code, so I don't expect this issue to be addressed there.