C++ code eat too much memory, growth from 30Mb to 100Mb

Hi.

Given Ubuntu 22.04 and gst 1.25, there C++ code which capture camera stream, read sample and write mp4 files within configured interval. It starts with 38Mb and then within few hours growth to over 100Mb.
Why it is so, what we are doing wrong? Maybe we misconfigured something?

Here is pipeline, full source link is below:

GstElement *create_capture_pipeline() {
    auto *pipeline = gst_parse_launch(
            "rtspsrc buffer_mode=0 name=rtspsrc ! rtph264depay ! h264parse ! tee name=vi"
            " vi. ! splitmuxsink name=sms"
            " vi. ! avdec_h264 ! jpegenc ! tee name=tp2"
            " tp2. ! queue max-size-buffers=10 leaky=2 name=appq"
            " tp2. ! multipartmux  boundary=mjpegstream  ! tcpserversink host=127.0.0.1 port=1234",
            nullptr);

    return pipeline;

Here is full source code – Share Code Snippets | CodersTool

Thanks in advance.