[Bug]: 修复new HeapProfiler时崩溃问题

desc: 修复new HeapProfiler时崩溃问题

solu: 使用原生new方式创建对象,而不使用NativeAreaAllocator来创建

issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I8KTZV

Signed-off-by: wanghuan2022 <wanghuan80@huawei.com>
Change-Id: Ic2d93cc4ae3455d443db4bcd0a016fc18bdee75b
This commit is contained in:
wanghuan2022 2023-11-30 18:54:15 +08:00
parent ecb7342211
commit 64a7fafc5d

View File

@ -521,7 +521,7 @@ void EcmaVM::DeleteHeapProfile()
if (heapProfile_ == nullptr) {
return;
}
const_cast<NativeAreaAllocator *>(GetNativeAreaAllocator())->Delete(heapProfile_);
delete heapProfile_;
heapProfile_ = nullptr;
}
@ -538,7 +538,7 @@ HeapProfilerInterface *EcmaVM::GetOrNewHeapProfile()
if (heapProfile_ != nullptr) {
return heapProfile_;
}
heapProfile_ = const_cast<NativeAreaAllocator *>(GetNativeAreaAllocator())->New<HeapProfiler>(this);
heapProfile_ = new HeapProfiler(this);
ASSERT(heapProfile_ != nullptr);
return heapProfile_;
}