ptrblck:

def f():
    x = torch.randn(1024, device='cuda')

print(torch.cuda.memory_summary())
for _ in range(1000):
    f()
print(torch.cuda.memory_summary())



Thanks for the demo. I got the meaning of  Tot Alloc and Tot Freed.
The GPU memory may not be the cause of the program’s pause.