Skip to content

Commit 70a3fb6

Browse files
committed
Test freeing the first pool of the linear base allocator
The first pool should be bigger than one page, but not big enough to hold all allocations, so that there were more pools allocated. This is needed to test freeing the first pool. Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 69a7591 commit 70a3fb6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/test_base_alloc_linear.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <thread>
1111

1212
#include "base_alloc_linear.h"
13+
#include "utils_common.h"
1314

1415
#include "base.hpp"
1516
#include "test_helpers.h"
@@ -56,9 +57,14 @@ TEST_F(test, baseAllocLinearMultiThreadedAllocMemset) {
5657

5758
srand(0);
5859

60+
// The first pool should be bigger than one page,
61+
// but not big enough to hold all allocations,
62+
// so that there were more pools allocated.
63+
// This is needed to test freeing the first pool.
64+
size_t pool_size = 2 * util_get_page_size();
65+
5966
auto pool = std::shared_ptr<umf_ba_linear_pool_t>(
60-
umf_ba_linear_create(NTHREADS * ITERATIONS * MAX_ALLOCATION_SIZE),
61-
umf_ba_linear_destroy);
67+
umf_ba_linear_create(pool_size), umf_ba_linear_destroy);
6268

6369
auto poolAlloc = [](int TID, umf_ba_linear_pool_t *pool) {
6470
struct buffer_t {

0 commit comments

Comments
 (0)