Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warnings and some minor fixes #77

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions test/c++/nda_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,20 @@ TEST(NDA, MemoryMultiBucketAllocator) {
bucket2[0] = allo.allocate_zero(chunksize);
EXPECT_EQ(allo.buckets().size(), 2);
EXPECT_TRUE(allo.owns(bucket2[0]));
EXPECT_TRUE(allo.buckets()[1].owns(bucket2[0]));
// The new bucket may be first inside allo.buckets(),
// as it respects memory ordering. Let's get the indeces
std::size_t first_bucket_idx = allo.buckets()[1].owns(bucket1[0]);
std::size_t second_bucket_idx = allo.buckets()[1].owns(bucket2[0]);
EXPECT_TRUE(allo.buckets()[first_bucket_idx].is_full());
EXPECT_FALSE(allo.buckets()[first_bucket_idx].owns(bucket2[0]));
EXPECT_TRUE(allo.buckets()[second_bucket_idx].owns(bucket2[0]));

// deallocate and reallocate in the 1st bucket
allo.deallocate(bucket1[20]);
EXPECT_FALSE(allo.buckets()[0].is_full());
EXPECT_FALSE(allo.buckets()[first_bucket_idx].is_full());
auto mb_realloc = allo.allocate_zero(chunksize);
EXPECT_TRUE(allo.buckets()[0].owns(mb_realloc));
EXPECT_TRUE(allo.buckets()[0].is_full());
EXPECT_TRUE(allo.buckets()[first_bucket_idx].owns(mb_realloc));
EXPECT_TRUE(allo.buckets()[first_bucket_idx].is_full());

// erase 2nd bucket
allo.deallocate(bucket2[0]);
Expand Down
Loading