!222 nnrt memory leak fixed 2.0

Merge pull request !222 from wangyifan/master
This commit is contained in:
openharmony_ci 2024-09-13 02:15:16 +00:00 committed by Gitee
commit 1b26d4aa9c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -48,11 +48,13 @@ NNRtServiceApi& NNRtServiceApi::GetInstance()
// Assumes there can be multiple instances of NN API
std::string nnrtLibraryName = "libdllite_service_client.z.so";
libNNRtService = dlopen(nnrtLibraryName.c_str(), RTLD_LAZY | RTLD_NODELETE);
if (libNNRtService == nullptr) {
LOGE("LoadNNRtService error: unable to open library %{public}s", nnrtLibraryName.c_str());
nnrtService.m_serviceAvailable = false;
return nnrtService;
libNNRtService = dlopen(nnrtLibraryName.c_str(), RTLD_LAZY | RTLD_NODELETE);
if (libNNRtService == nullptr) {
LOGE("LoadNNRtService error: unable to open library %{public}s", nnrtLibraryName.c_str());
nnrtService.m_serviceAvailable = false;
return nnrtService;
}
}
LoadFunction(libNNRtService, "CheckModelSizeFromPath", &nnrtService.CheckModelSizeFromPath);