diff --git a/ecmascript/napi/dfx_jsnapi.cpp b/ecmascript/napi/dfx_jsnapi.cpp index e24adde3..1181f9d0 100644 --- a/ecmascript/napi/dfx_jsnapi.cpp +++ b/ecmascript/napi/dfx_jsnapi.cpp @@ -54,9 +54,10 @@ void DFXJSNApi::DumpHeapSnapshot(EcmaVM *vm, int dumpFormat, Stream *stream, Pro ecmascript::HeapProfilerInterface::Destroy(vm); } -#if defined(ENABLE_DUMP_IN_FAULTLOG) -void DFXJSNApi::DumpHeapSnapshot(EcmaVM *vm, int dumpFormat, bool isVmMode, bool isPrivate) +void DFXJSNApi::DumpHeapSnapshot([[maybe_unused]] EcmaVM *vm, [[maybe_unused]] int dumpFormat, + [[maybe_unused]] bool isVmMode, [[maybe_unused]] bool isPrivate) { +#if defined(ENABLE_DUMP_IN_FAULTLOG) // Write in faultlog for heap leak. int32_t fd = RequestFileDescriptor(static_cast(FaultLoggerType::JS_HEAP_SNAPSHOT)); if (fd < 0) { @@ -66,8 +67,8 @@ void DFXJSNApi::DumpHeapSnapshot(EcmaVM *vm, int dumpFormat, bool isVmMode, bool FileDescriptorStream stream(fd); DumpHeapSnapshot(vm, dumpFormat, &stream, nullptr, isVmMode, isPrivate); close(fd); -} #endif +} bool DFXJSNApi::BuildNativeAndJsBackStackTrace(EcmaVM *vm, std::string &stackTraceStr) { diff --git a/ecmascript/napi/include/dfx_jsnapi.h b/ecmascript/napi/include/dfx_jsnapi.h index 6ee442b9..637debac 100644 --- a/ecmascript/napi/include/dfx_jsnapi.h +++ b/ecmascript/napi/include/dfx_jsnapi.h @@ -44,10 +44,7 @@ public: bool isPrivate = false); static void DumpHeapSnapshot(EcmaVM *vm, int dumpFormat, Stream *stream, Progress *progress = nullptr, bool isVmMode = true, bool isPrivate = false); - -#if defined(ENABLE_DUMP_IN_FAULTLOG) static void DumpHeapSnapshot(EcmaVM *vm, int dumpFormat, bool isVmMode = true, bool isPrivate = false); -#endif static bool BuildNativeAndJsBackStackTrace(EcmaVM *vm, std::string &stackTraceStr); static bool StartHeapTracking(EcmaVM *vm, double timeInterval, bool isVmMode = true);