nnrt memory leak fixed 2.0

Signed-off-by: w30052974 <wangyifan94@huawei.com>
This commit is contained in:
w30052974 2024-09-12 18:44:21 +08:00
parent e4000e4be3
commit e25f0d30db

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);