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:
- App1 starts, initializes and waits for the frames to decode;
- App2 starts, initializes and waits for the frames to decode;
- Encoded frames arrive in the App2, it successfully decodes them and then terminates abnormally (crashes);
- 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:
- Is this desired behaviour?
- If not, are there any bugfixes planned to address this issue?
- Any workarounds you can suggest?
A custom i.MX6DP-based board.
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.