diff options
| author | 2022-11-14 21:42:39 -0800 | |
|---|---|---|
| committer | 2022-11-15 09:02:25 +0000 | |
| commit | 07c68601ddf623a699892ed0dd5ec87b7a05fd02 (patch) | |
| tree | 0531c303e71d47daf0244096634130c4b6c4253f | |
| parent | adf67c598d53d0820a213650ba94f6ce954db0ef (diff) | |
Fix DCHECK when freeing last obj from free-list large-object space
Bug: 160737021
Test: art/test/testrunner/testrunner.py --target -t 659-unpadded-array
Change-Id: I363bc98709a8523c8a33aaa5f0bb7f8e218d0d1f
| -rw-r--r-- | runtime/gc/space/large_object_space.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/gc/space/large_object_space.cc b/runtime/gc/space/large_object_space.cc index 2d17a18a36..f1df45f19a 100644 --- a/runtime/gc/space/large_object_space.cc +++ b/runtime/gc/space/large_object_space.cc @@ -336,7 +336,7 @@ class AllocationInfo { size_t FreeListSpace::GetSlotIndexForAllocationInfo(const AllocationInfo* info) const { DCHECK_GE(info, allocation_info_); - DCHECK_LT(info, reinterpret_cast<AllocationInfo*>(allocation_info_map_.End())); + DCHECK_LE(info, reinterpret_cast<AllocationInfo*>(allocation_info_map_.End())); return info - allocation_info_; } @@ -457,6 +457,10 @@ size_t FreeListSpace::Free(Thread* self, mirror::Object* obj) { // The previous allocation info must not be free since we are supposed to always coalesce. DCHECK_EQ(info->GetPrevFreeBytes(), 0U) << "Previous allocation was free"; } + // NOTE: next_info could be pointing right after the allocation_info_map_ + // when freeing object in the very end of the space. But that's safe + // as we don't dereference it in that case. We only use it to calculate + // next_addr using offset within the map. uintptr_t next_addr = GetAddressForAllocationInfo(next_info); if (next_addr >= free_end_start) { // Easy case, the next chunk is the end free region. |