PyTorch's share_memory() release strategy

I have a system with uses multiple threads and processes, which communicate with one another using queues. For optimization I’m storing the Tensor’s which are passing between them in shared memory.

I’m experiencing a memory leak, and I suspect it relates to the fact that the completed tensors are not released from share memory. It would be helpful to get input on how pytorch’s shared memory objects release is performed / how to handle it.