CUDA memory not being freed?

In general I don’t explicitly set volatile to be True when creating variables, but I’m also taking gradients with respect to the inputs (Variable(batch.cuda(), requires_grad=True) in this case), so those variables can’t be volatile. The only things that I could make volatile are the weights of the model itself. From this thread (Why can’t model parameters be variables?) it seems that I can’t do that, since model parameters have requires_grad true by default.

Though I also don’t think it should matter, so long as all memory is being freed after each minibatch, which it should be: if I can do one minibatch and then free all memory (thereby returning to the original state), I should be able to do all minibatches.