diff --git a/common_components/heap/allocator/region_manager.cpp b/common_components/heap/allocator/region_manager.cpp index feee6f3bf1798f694320fb0196362cdc04b2dd12..f84f5a14c4fceedb79e6a4a1b52662d3687389b1 100755 --- a/common_components/heap/allocator/region_manager.cpp +++ b/common_components/heap/allocator/region_manager.cpp @@ -136,6 +136,17 @@ void RegionDesc::VisitAllObjectsBefore(const std::function & // GetAllocSize should before call func, because object maybe destroy in compact gc. func(reinterpret_cast(position)); size_t size = RegionSpace::GetAllocSize(*reinterpret_cast(position)); + if (position + size > end) { + std::string s = std::to_string(position) + " " + std::to_string(size) + " " + std::to_string(end) + ":"; + for (int i = -10; i < 10; ++i) { + size_t addr = position + i * 8; + uint64_t *ptr = reinterpret_cast(reinterpret_cast(addr)); + uint64_t val = *ptr; + s += std::to_string(i) + ", " + std::to_string(val) + ";"; + } + LOG_COMMON(FATAL) << s; + std::abort(); + } position += size; } } @@ -187,7 +198,19 @@ bool RegionDesc::VisitLiveObjectsUntilFalse(const std::function(position); if (collector.IsSurvivedObject(obj) && !func(obj)) { return false; } - position += RegionSpace::GetAllocSize(*obj); + size_t size = RegionSpace::GetAllocSize(*obj); + if (position + size > allocPtr) { + std::string s = std::to_string(position) + " " + std::to_string(size) + " " + std::to_string(allocPtr) + ":"; + for (int i = -10; i < 10; ++i) { + size_t addr = position + i * 8; + uint64_t *ptr = reinterpret_cast(reinterpret_cast(addr)); + uint64_t val = *ptr; + s += std::to_string(i) + ", " + std::to_string(val) + ";"; + } + LOG_COMMON(FATAL) << s; + std::abort(); + } + position += size; } } return true; diff --git a/common_components/heap/verification.cpp b/common_components/heap/verification.cpp index 440ec9715e8fee035e24ca6408754007755f9df0..1c7aa86f622d082a38017ed8caf36b377c8f5b4d 100755 --- a/common_components/heap/verification.cpp +++ b/common_components/heap/verification.cpp @@ -368,9 +368,6 @@ public: // EnumRoot, so it must have been marked. There is no need for me to // check it, nor to push it into the mark stack. if (refObj->IsForwarded()) { - auto toObj = refObj->GetForwardingPointer(); - bool find = markSet.find(toObj) != markSet.end(); - CHECKF(find) << "not found to version obj in markSet"; return; }