A TPU memory leak occurs when calling iter on the MpDeviceLoader object, even if called only once. However, the memory growth becomes more noticeable and critical when iter is called repeatedly, eventually leading to a crash. This issue is caused by the threads not being properly terminated because the close() method was not invoked.
This commit resolves the issue by ensuring that close() is called, which properly shuts down the threads and prevents memory from leaking.
A TPU memory leak occurs when calling iter on the MpDeviceLoader object, even if called only once. However, the memory growth becomes more noticeable and critical when iter is called repeatedly, eventually leading to a crash. This issue is caused by the threads not being properly terminated because the close() method was not invoked.
This commit resolves the issue by ensuring that close() is called, which properly shuts down the threads and prevents memory from leaking.