*** Error in `python': free(): invalid size: 0x00007f857aeacb00 ***

I meet this error with pytorch 0.4 and python 3.5, when I try to train and then evaluate the network every epoch. After several epoches, it throws this error and can not free the GPU memory.
Anyone to help figure out what is the problem?


Could you provide a small code sample (20-50 lines) that reproduces this problem so that we can investigate it please?

I am afraid I couldn’t provide the code currently. Actually the same code run in another machine is just fine. This error always happens when the code run into evaluation mode on the validation dataset. I am trying to stop the evaluation part to see what happes.