i.MX6DP VPU driver leaks memory on application crash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX6DP VPU driver leaks memory on application crash

930 Views
rostyslavkhudol
Contributor III

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.

Labels (2)
3 Replies

771 Views
igorpadykov
NXP Employee
NXP Employee

Hi Rostyslav

libimxvpuapi is community project not supported by nxp, issue may be

posted on Issues · Freescale/libimxvpuapi · GitHub 

Alternatvely one can try with nxp gstreamer "imx-gst1.0-plugins", usage

is described in Linux Guide included in Linux 4.19.35_1.1.0 Documentation

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

771 Views
rostyslavkhudol
Contributor III

Hi Igor,

Thank you for reaching back.

However, as you may see from my post it is the driver that leaks memory, not the library being used. In particular, the vpu_release(), which is called every time a descriptor for /dev/mxc_vpu is closed. I don't see how trying Gstreamer plugins would help here.

0 Kudos

771 Views
igorpadykov
NXP Employee
NXP Employee

Hi Rostyslav

 

please try to reproduce issue with official nxp gstreamer "imx-gst1.0-plugins", usage

is described in Linux Guide included in Linux 4.19.35_1.1.0 Documentation

 

Best regards
igor

0 Kudos