How to release pinned memory actively?

I have a large batch size and limited cpu memory. After an epoch, the pinned memory consumed by train dataset will occupate much cpu memory, so I don’t have enough piined memory for validation dataset.
I tried to del variable but find the pinned memory won’t be released. How to release pinned memory actively?