mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
fix: clear AllocationsList tail on free all
Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a8c79e0ba1
commit
43841fd2ef
@@ -93,5 +93,6 @@ void AllocationsList::freeAllGraphicsAllocations(Device *neoDevice) {
|
||||
curr = currNext;
|
||||
}
|
||||
head = nullptr;
|
||||
tail = nullptr;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -3089,3 +3089,22 @@ TEST(MemoryManagerTest, givenDuplicateRootDeviceIndicesWhenCreatingMultiGraphics
|
||||
|
||||
memoryManager.freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST(AllocationListTest, givenAllocationInListWhenFreeAllGraphicsAllocationsCalledThenHeadAndTailIsNullptr) {
|
||||
AllocationsList allocList;
|
||||
EXPECT_EQ(nullptr, allocList.peekHead());
|
||||
EXPECT_EQ(nullptr, allocList.peekTail());
|
||||
EXPECT_TRUE(allocList.peekIsEmpty());
|
||||
|
||||
auto mockGfxAllocation = std::make_unique<MockGraphicsAllocation>();
|
||||
allocList.pushFrontOne(*mockGfxAllocation.release());
|
||||
EXPECT_NE(nullptr, allocList.peekHead());
|
||||
EXPECT_NE(nullptr, allocList.peekTail());
|
||||
EXPECT_FALSE(allocList.peekIsEmpty());
|
||||
|
||||
MockDevice mockDevice;
|
||||
allocList.freeAllGraphicsAllocations(&mockDevice);
|
||||
EXPECT_EQ(nullptr, allocList.peekHead());
|
||||
EXPECT_EQ(nullptr, allocList.peekTail());
|
||||
EXPECT_TRUE(allocList.peekIsEmpty());
|
||||
}
|
||||
Reference in New Issue
Block a user