From beb432ea1915b63c481443ff76623dc6d2aa73a3 Mon Sep 17 00:00:00 2001 From: l00809476 Date: Thu, 3 Jul 2025 10:00:35 +0800 Subject: [PATCH] Call OOM when memory is low Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICJLOL Signed-off-by: l00809476 --- common_components/heap/w_collector/w_collector.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common_components/heap/w_collector/w_collector.cpp b/common_components/heap/w_collector/w_collector.cpp index 832c9da2e3..5c2d7f0657 100755 --- a/common_components/heap/w_collector/w_collector.cpp +++ b/common_components/heap/w_collector/w_collector.cpp @@ -292,7 +292,10 @@ public: DLOG(FIX, "visit raw-ref @%p: %p", &refField, oldObj); if (collector_->IsFromObject(oldObj)) { BaseObject* toVersion = collector_->TryForwardObject(oldObj); - CHECK_CC(toVersion != nullptr); + if (toVersion == nullptr) { + Heap::throwOOM(); + return; + } HeapProfilerListener::GetInstance().OnMoveEvent(reinterpret_cast(oldObj), reinterpret_cast(toVersion), toVersion->GetSize()); @@ -881,7 +884,7 @@ BaseObject* WCollector::CopyObjectAfterExclusive(BaseObject* obj) } BaseObject* toObj = fwdTable_.RouteObject(obj, size); if (toObj == nullptr) { - ASSERT_LOGF(0, "OOM"); + Heap::throwOOM(); // ConcurrentGC obj->UnlockExclusive(BaseStateWord::ForwardState::NORMAL); return toObj; -- Gitee