@smth
Thanks! Do you means that:
def func():
  a = Variable(torch.randn(2,2))
  a = Variable(torch.randn(100,100))
  return 

the memory allocated in a = Variable(torch.randn(2,2)) will be freed as soon as the code a = Variable(torch.randn(100,100)) is executed?