Gstreamer leaky queue stops the pipeline

I wanted to find a minimum reproducible sample to understand the queue behavior. I’d like to use a the queue to drop data in a more complex pipeline when the pipeline can’t process the frames fast enough. However, I noticed that the queue was not working in that situation, as the pipeline was producing a memory leak.

This is related: Memory leak in DeepStream - #12 by marcoslucianops