Can you try running your model inside torch.no_grad()? By default, autograd engine is on, therefore gradients will be computed. Which is why your RAM gets accumulated and goes out of memory after consecutive forward passes.
Something like,
for i in range(1000):
    with torch.no_grad():
        net(torch.randn(in_size))