fix: clear AllocationsList tail on free all
Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
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());
|
||||
}
|
Loading…
Reference in New Issue