tegra_multimedia_api example memory leak

I am making a v4l2 record program.

and I used tegra_multimedia_api/samples/frontend example.

here is my problem.

When I loop VideoEncoder::initialize() and VideoEncoder::shutdown()

avail Mem keep decrease. (in cmdline ‘top’ program)
but my program’s %MEM is not increase.

If I remove this source (in VideoEncoder::initialize() method) then, avail Mem not decrease.

// Enqueue all the empty capture plane buffers
    for (uint32_t i = 0; i < m_VideoEncoder->capture_plane.getNumBuffers(); i++)
    {
        struct v4l2_buffer v4l2_buf;
        struct v4l2_plane planes[MAX_PLANES];

        memset(&v4l2_buf, 0, sizeof(v4l2_buf));
        memset(planes, 0, MAX_PLANES * sizeof(struct v4l2_plane));

        v4l2_buf.index = i;
        v4l2_buf.m.planes = planes;

        m_VideoEncoder->capture_plane.qBuffer(v4l2_buf, NULL);
    }

What am I missing?

PLease try the prebuilt lib at https://elinux.org/Jetson_TX2/28.2.1_patches
[MMAPI]Cannot run NvVideoDecoder in loop/Memory leak in NvVideoEncoder

It work!!!

Thank you~