Memory leak during cv::VideoCapture

Hi, i use khadas’s official OS08A10 Camera and VIM3 to capture images. My code is:

#include <opencv2/opencv.hpp>
#include <iostream>
int main()
    cv::VideoCapture video(0);
    video.set(cv::CAP_PROP_FRAME_WIDTH, 1920);
    video.set(cv::CAP_PROP_FRAME_HEIGHT, 1080);
    if (video.isOpened())
        return -1;
    while (1)
        cv::Mat frame;
        video >> frame;
        if (frame.empty())
        cv::imshow("video", frame);
    return 0;

Following this instruction Upgrade The System To Latest Version | Khadas Documentation , I updated the system to latest version. Opencv4 is installed by

sudo apt install libopencv-dev python3-opencv

During the image capturing, memory leak fast. For 9 hours, it will leak around 500MB.

I tried the same code on my laptop with usb camera and Opencv4, no memory leak.

Any helps or suggestions ? Thanks.