Memory allocation last pytorch version

Hello everyone.

I have realized that the new version from pytorch allocate and deallocate memory dynamically. In previous version if my model needs 5GB, as example, those GB where allocated and where not freed during training. However now I check that if less memory is needed during validation, pytorch deallocate memory and then allocate for training. Is there a way to tell pytorch to behave as in the old way?