diff --git a/ecmascript/mem/heap.cpp b/ecmascript/mem/heap.cpp index 6ba62cfdd6901c53c3b6ec4bb415b9ab92cf4af4..4aa241ae1878d325cfb14905af846ff6e6a3ae4b 100644 --- a/ecmascript/mem/heap.cpp +++ b/ecmascript/mem/heap.cpp @@ -2756,9 +2756,16 @@ size_t Heap::GetHeapLimitSize() const bool BaseHeap::IsAlive(TaggedObject *object) const { - if (!ContainObject(object)) { - LOG_GC(ERROR) << "The region is already free"; - return false; + if (g_isEnableCMCGC) { + if (!common::Heap::IsHeapAddress(object)) { + LOG_GC(ERROR) << "The region is already free"; + return false; + } + } else { + if (!ContainObject(object)) { + LOG_GC(ERROR) << "The region is already free"; + return false; + } } bool isFree = object->GetClass() != nullptr && FreeObject::Cast(ToUintPtr(object))->IsFreeObject();