Description
llvm/sycl/source/detail/online_compiler/online_compiler.cpp
Lines 101 to 104 in 83fe1c1
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.