mirror of
https://gitee.com/openharmony/security_device_auth
synced 2025-02-17 06:48:15 +00:00
!887 disable memory cache and delayed free
Merge pull request !887 from 何寅燊/master
This commit is contained in:
commit
75eee20d19
@ -31,6 +31,10 @@
|
||||
|
||||
#include "deviceauth_sa.h"
|
||||
|
||||
#ifdef DEV_AUTH_USE_JEMALLOC
|
||||
#include "malloc.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
|
||||
static const uint32_t RESTORE_CODE = 14701;
|
||||
@ -194,9 +198,18 @@ void DeviceAuthAbility::OnStart()
|
||||
LOGI("DeviceAuthAbility start success.");
|
||||
}
|
||||
|
||||
static void DevAuthInitMemoryPolicy(void)
|
||||
{
|
||||
#ifdef DEV_AUTH_USE_JEMALLOC
|
||||
(void)mallopt(M_SET_THREAD_CACHE, M_THREAD_CACHE_DISABLE);
|
||||
(void)mallopt(M_DELAYED_FREE, M_DELAYED_FREE_DISABLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t DeviceAuthAbility::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
|
||||
MessageOption &option)
|
||||
{
|
||||
DevAuthInitMemoryPolicy();
|
||||
std::u16string readToken = data.ReadInterfaceToken();
|
||||
|
||||
bool isRestoreCall = ((code == RESTORE_CODE) && (readToken == std::u16string(u"OHOS.Updater.RestoreData")));
|
||||
|
@ -33,6 +33,10 @@
|
||||
#include "hisysevent_adapter.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEV_AUTH_USE_JEMALLOC
|
||||
#include "malloc.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
namespace OHOS {
|
||||
static std::mutex g_cBMutex;
|
||||
@ -272,9 +276,18 @@ int32_t ServiceDevAuth::HandleDeviceAuthCall(uint32_t code, MessageParcel &data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void DevAuthInitMemoryPolicy(void)
|
||||
{
|
||||
#ifdef DEV_AUTH_USE_JEMALLOC
|
||||
(void)mallopt(M_SET_THREAD_CACHE, M_THREAD_CACHE_DISABLE);
|
||||
(void)mallopt(M_DELAYED_FREE, M_DELAYED_FREE_DISABLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t ServiceDevAuth::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
|
||||
MessageOption &option)
|
||||
{
|
||||
DevAuthInitMemoryPolicy();
|
||||
std::u16string readToken = data.ReadInterfaceToken();
|
||||
bool isRestoreCall = ((code == RESTORE_CODE) && (readToken == std::u16string(u"OHOS.Updater.RestoreData")));
|
||||
if (readToken != GetDescriptor() && !isRestoreCall) {
|
||||
|
@ -320,6 +320,11 @@ if (os_level == "mini" || os_level == "small") {
|
||||
if (target_cpu == "arm") {
|
||||
cflags += [ "-DBINDER_IPC_32BIT" ]
|
||||
}
|
||||
if (use_musl) {
|
||||
if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
|
||||
defines += [ "DEV_AUTH_USE_JEMALLOC" ]
|
||||
}
|
||||
}
|
||||
|
||||
include_dirs += [
|
||||
"${frameworks_path}/inc",
|
||||
|
Loading…
x
Reference in New Issue
Block a user