How to dataloader delete memory

hello i’m james.

my model use three dataset.

and computer memory is 48gb.

batch size is 16.

each data load, and train model–> three times.

first: cifar10 train
second : svhn train
third : mnist train

my memory leaked.

so i want to know that when first train is finished, delete first dataloader’s memory.

how to delete dataloader’s memory?

thank you

When you see a memory leak, it won’t help to delete the DataLoader or the Dataset.
Are you storing the computation graph somewhere, e.g. by appending the loss to a list without detaching?