diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..cc79198d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,79 @@ +{ + "files.associations": { + "xstring": "cpp", + "algorithm": "cpp", + "atomic": "cpp", + "bit": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "charconv": "cpp", + "chrono": "cpp", + "cinttypes": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "codecvt": "cpp", + "compare": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "exception": "cpp", + "format": "cpp", + "forward_list": "cpp", + "fstream": "cpp", + "functional": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "ios": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "iterator": "cpp", + "limits": "cpp", + "list": "cpp", + "locale": "cpp", + "map": "cpp", + "memory": "cpp", + "mutex": "cpp", + "new": "cpp", + "optional": "cpp", + "ostream": "cpp", + "ratio": "cpp", + "regex": "cpp", + "set": "cpp", + "shared_mutex": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "stop_token": "cpp", + "streambuf": "cpp", + "string": "cpp", + "system_error": "cpp", + "thread": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "typeinfo": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "utility": "cpp", + "vector": "cpp", + "xfacet": "cpp", + "xhash": "cpp", + "xiosbase": "cpp", + "xlocale": "cpp", + "xlocbuf": "cpp", + "xlocinfo": "cpp", + "xlocmes": "cpp", + "xlocmon": "cpp", + "xlocnum": "cpp", + "xloctime": "cpp", + "xmemory": "cpp", + "xtr1common": "cpp", + "xtree": "cpp", + "xutility": "cpp" + } +} \ No newline at end of file diff --git a/old/services/core/src/distributed_device_profile_service.cpp b/old/services/core/src/distributed_device_profile_service.cpp index 67b19b34..021d6b0e 100644 --- a/old/services/core/src/distributed_device_profile_service.cpp +++ b/old/services/core/src/distributed_device_profile_service.cpp @@ -269,6 +269,10 @@ int32_t DistributedDeviceProfileService::OnIdle(const SystemAbilityOnDemandReaso void DistributedDeviceProfileService::OnStop() { HILOGI("called"); + if (!DistributedDeviceProfile::DistributedDeviceProfileServiceNew::GetInstance().UnInit()) { + HILOGE("UnInit failed"); + return; + } } bool DistributedDeviceProfileService::DoInit() diff --git a/sa_profile/6001.json b/sa_profile/6001.json index 508f2abb..27b60a08 100644 --- a/sa_profile/6001.json +++ b/sa_profile/6001.json @@ -7,6 +7,7 @@ "run-on-create": false, "distributed": true, "dump-level": 1, + "recycle-strategy": "low-memory", "start-on-demand": { "deviceonline": [ { diff --git a/services/core/src/distributed_device_profile_service_new.cpp b/services/core/src/distributed_device_profile_service_new.cpp index 7a3315b5..22047520 100644 --- a/services/core/src/distributed_device_profile_service_new.cpp +++ b/services/core/src/distributed_device_profile_service_new.cpp @@ -166,6 +166,7 @@ int32_t DistributedDeviceProfileServiceNew::UnInit() HILOGE("EventHandlerFactory UnInit failed"); return DP_CACHE_UNINIT_FAIL; } + DestroyUnloadHandler(); HILOGI("init succeeded"); return DP_SUCCESS; } diff --git a/services/core/src/permissionmanager/permission_manager.cpp b/services/core/src/permissionmanager/permission_manager.cpp index d1b53ff0..3ee6465f 100644 --- a/services/core/src/permissionmanager/permission_manager.cpp +++ b/services/core/src/permissionmanager/permission_manager.cpp @@ -63,6 +63,10 @@ int32_t PermissionManager::Init() int32_t PermissionManager::UnInit() { HILOGI("UnInit"); + { + std::lock_guard lockGuard(permissionMutex_); + permissionMap_.clear(); + } return DP_SUCCESS; } diff --git a/services/core/src/subscribeprofilemanager/subscribe_profile_manager.cpp b/services/core/src/subscribeprofilemanager/subscribe_profile_manager.cpp index 6c8d1c55..aa97d3f8 100644 --- a/services/core/src/subscribeprofilemanager/subscribe_profile_manager.cpp +++ b/services/core/src/subscribeprofilemanager/subscribe_profile_manager.cpp @@ -44,6 +44,11 @@ int32_t SubscribeProfileManager::Init() int32_t SubscribeProfileManager::UnInit() { HILOGI("call!"); + { + std::lock_guard lockGuard(subscribeMutex_); + subscribeInfoMap_.clear(); + } + funcsMap_.clear(); return DP_SUCCESS; } diff --git a/services/core/src/utils/profile_cache.cpp b/services/core/src/utils/profile_cache.cpp index cc64837a..8e3aeff7 100644 --- a/services/core/src/utils/profile_cache.cpp +++ b/services/core/src/utils/profile_cache.cpp @@ -65,6 +65,30 @@ int32_t ProfileCache::Init() int32_t ProfileCache::UnInit() { HILOGI("UnInit"); + { + std::lock_guard lock(onlineDeviceLock_); + onlineDevMap_.clear(); + } + { + std::lock_guard lock(deviceProfileMutex_); + deviceProfileMap_.clear(); + } + { + std::lock_guard lock(serviceProfileMutex_); + serviceProfileMap_.clear(); + } + { + std::lock_guard lock(charProfileMutex_); + charProfileMap_.clear(); + } + { + std::lock_guard lock(staticCharProfileMutex_); + staticCharProfileMap_.clear(); + } + { + std::lock_guard lock(syncListenerMutex_); + syncListenerMap_.clear(); + } return DP_SUCCESS; }