-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add RAII file wrappers to avoid resource leak #614
Conversation
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved trivial CMake changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
void CUFileHandleWrapper::unregister_handle() noexcept | ||
{ | ||
if (registered()) { | ||
cuFileAPI::instance().HandleDeregister(_handle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Non-success error codes from the system call close()
and cuFileHandleDeregister()
are currently left unhandled in order to keep the destructor noexcept
. Maybe in the future we could consider having some logging mechanism or having some global error states for these rare but not impossible cases? Or simply removing the noexcept
promise from the destructor? @madsbk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the dtor noexcept
, but maybe print to stderr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Added to error.hpp/cpp
. It looks like cuFileDeregister()
returns void, so this rare error logging is only done for ::close()
atm.
@kingcrimsontianyu, please feel free to merge when ready. |
/merge |
Closes #607