Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parallel_loader: Fix TPU memory leak when calling __iter__. #8039

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dudulightricks
Copy link

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.

@dudulightricks
Copy link
Author

@JackCaoG

@will-cromar
Copy link
Collaborator

LGTM. Please address the linter complaints, then we can merge this

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.
@dudulightricks dudulightricks force-pushed the bug-fix/mp-device-loader-memory-leak branch from 984af38 to 744bf9b Compare September 19, 2024 18:42
@dudulightricks
Copy link
Author

@will-cromar Thanks. Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants