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

Resource leaks in online compiler implementation #16330

Open
AlexeySachkov opened this issue Dec 11, 2024 · 0 comments
Open

Resource leaks in online compiler implementation #16330

AlexeySachkov opened this issue Dec 11, 2024 · 0 comments
Labels
bug Something isn't working confirmed

Comments

@AlexeySachkov
Copy link
Contributor

void *OclocLibrary = sycl::detail::ur::loadOsLibrary(OclocLibraryName);
if (!OclocLibrary)
throw online_compile_error("Cannot load ocloc library: " +
OclocLibraryName);

loadOsLibrary is a wrapper around dlopen/LoadLibraryEx and both those functions require a de-allocation call once resource has been used. However, we don't do that at all in our online compiler implementation.

Note that resource leak will happen every time we throw an exception. It is not like this is a high-impact thing, because if we threw an exception saying that we couldn't load ocloc, it is unlikely that we will succeed on retry and most likely such exception will cause a SYCL app to reach a full stop. At this point, OS should help us properly free all resources.

However, that is still an issue which static analyzer highlights, regardless of its actual impact. The suggestion here is that we update our loadOsLibrary function to return a unique_ptr which will have a correct deleter assigned to it. That way, resources will be freed automatically.

@AlexeySachkov AlexeySachkov added bug Something isn't working confirmed labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed
Projects
None yet
Development

No branches or pull requests

1 participant