Can you obtain a memory dump and see what is leaking?
Otherwise any discussion we could have is just guessing thus useless.
Yes, I'm currently doing that but that is not a trivial undertaking and would take some time. In the meantime, I still wanted to know how to set the queue size so that only a certain amount of messages at a time can be consumed. Is there an easy way to achieve this?