[CP] support alloc_align/free_align for ObIAllocator

This commit is contained in:
tushicheng
2024-07-25 12:54:19 +00:00
committed by ob-robot
parent 7cc412c2ba
commit cb77423ea8
6 changed files with 69 additions and 58 deletions

View File

@ -91,6 +91,15 @@ TEST_F(TestAllocator, basic)
sz = ((sz | reinterpret_cast<size_t>(p[0])) & ((1<<13) - 1));
}
// test alloc_align/free_align
for (int i = 0; i < 10; ++i) {
int64_t align = 8<<i;
void *ptr = a.alloc_align(100, align);
ASSERT_EQ(0, (int64_t)ptr & (align - 1));
ASSERT_GT(a.used(), 0);
a.free_align(ptr);
ASSERT_EQ(a.used(), 0);
}
cout << "done" << endl;
}