mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-27 04:00:37 +00:00
Fix dump bug
Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAZ8KE Signed-off-by: xwcai98 <caixinwei5@huawei.com> Change-Id: I23805eb135b6a753b95a0dfe3211fc8fddc467ad
This commit is contained in:
parent
be29f2f4b5
commit
31b2a0cdb9
@ -269,6 +269,16 @@ public:
|
||||
isVerifying_ = verifying;
|
||||
}
|
||||
|
||||
void SetGCState(bool inGC)
|
||||
{
|
||||
inGC_ = inGC;
|
||||
}
|
||||
|
||||
bool InGC() const
|
||||
{
|
||||
return inGC_;
|
||||
}
|
||||
|
||||
void NotifyHeapAliveSizeAfterGC(size_t size)
|
||||
{
|
||||
heapAliveSizeAfterGC_ = size;
|
||||
@ -372,6 +382,7 @@ protected:
|
||||
LOG_GC(FATAL) << "Recursion in HeapCollectGarbage(isShared=" << static_cast<int>(heapType_)
|
||||
<< ") Constructor, depth: " << heap_->recursionDepth_;
|
||||
}
|
||||
heap_->SetGCState(true);
|
||||
}
|
||||
~RecursionScope()
|
||||
{
|
||||
@ -379,6 +390,7 @@ protected:
|
||||
LOG_GC(FATAL) << "Recursion in HeapCollectGarbage(isShared=" << static_cast<int>(heapType_)
|
||||
<< ") Destructor, depth: " << heap_->recursionDepth_;
|
||||
}
|
||||
heap_->SetGCState(false);
|
||||
}
|
||||
private:
|
||||
BaseHeap *heap_ {nullptr};
|
||||
@ -416,6 +428,7 @@ protected:
|
||||
// ONLY used for heap verification.
|
||||
bool shouldVerifyHeap_ {false};
|
||||
bool isVerifying_ {false};
|
||||
bool inGC_ {false};
|
||||
int32_t recursionDepth_ {0};
|
||||
#ifndef NDEBUG
|
||||
bool triggerCollectionOnNewObject_ {true};
|
||||
|
@ -44,7 +44,9 @@ Region *HeapRegionAllocator::AllocateAlignedRegion(Space *space, size_t capacity
|
||||
if (mapMem == nullptr) { // LOCV_EXCL_BR_LINE
|
||||
if (thread != nullptr && thread->GetEcmaVM()->IsInitialized()) {
|
||||
Heap *localHeap = const_cast<Heap *>(thread->GetEcmaVM()->GetHeap());
|
||||
localHeap->DumpHeapSnapshotBeforeOOM();
|
||||
if (!localHeap->InGC()) {
|
||||
localHeap->DumpHeapSnapshotBeforeOOM();
|
||||
}
|
||||
heap->ThrowOutOfMemoryErrorForDefault(thread, DEFAULT_REGION_SIZE,
|
||||
"HeapRegionAllocator::AllocateAlignedRegion", false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user