Hi All,
RT.
In our project, we used glTexDirectVIVMap to reduce CPU load, but we found it caused memory leak issue,
how to fix it? is there the existed patch to fix it?
Source code as follow:
=============================================
v4l2_buffer v4l2buf;
/* v4l2 setup: MMAP memory mode */
if (ioctl(fd_v4l, VIDIOC_DQBUF, &v4l2buf) < 0)
{
printf("line=%d, fd_v4l, VIDIOC_DQBUF error!!!\n", __LINE__);
return -1;
}
GLuint physical = ~0U;
/* m_pvirtualaddr: mmap(xxx) from V4L2 DMA address, just do mmap one time when v4l2 setup */
glTexDirectVIVMap(GL_TEXTURE_2D, g_cap_width, g_cap_height,
GL_VIV_UYVY, (GLvoid**)&(m_pvirtualaddr), &physical);
=============================================
I can confirm this memory leak on Kernel 4.1.15-1.1.0.
We stumbled upon the problem when displaying analog camera video with QtGStreamer. The workaround is to pass the actual physical address to glTexDirectVIVMap(), instead of ~0U. I've created a patch for QtGStreamer here: Bug 730863 – qtvideosink: add i.MX6 zero-copy rendering implementation .
Note that this is just a workaround, and seems to work fine - however the real issue is clearly a Kernel bug, since the memory isn't even freed when the process exits.
Hi Jason
L3.0.35_4.1.0 has memory leak issues as answered by experts on
Long running vpu task with memory leak bug on imx6
one can try L3.0.101
however highly recommended to migrate to new kernels where this is fixed.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------