@@ -150,6 +150,26 @@ TEST_P(umfPoolTest, allocFreeNonAlignedSizes) {
150150 }
151151}
152152
153+ TEST_P (umfPoolTest, allocFreeAligned) {
154+ #ifdef _WIN32
155+ // TODO: implement support for windows
156+ GTEST_SKIP ();
157+ #else
158+ if (!umf_test::isAlignedAllocSupported (pool.get ())) {
159+ GTEST_SKIP ();
160+ }
161+
162+ size_t alignment = 2097152 ;
163+ void *ptr = umfPoolAlignedMalloc (pool.get (), 1 , alignment);
164+ ASSERT_NE (ptr, nullptr );
165+ ASSERT_TRUE (reinterpret_cast <uintptr_t >(ptr) % alignment == 0 );
166+ *(reinterpret_cast <char *>(ptr)) = (char )0xFF ;
167+
168+ umf_result_t umf_result = umfPoolFree (pool.get (), ptr);
169+ ASSERT_EQ (umf_result, UMF_RESULT_SUCCESS);
170+ #endif
171+ }
172+
153173TEST_P (umfPoolTest, reallocFree) {
154174 if (!umf_test::isReallocSupported (pool.get ())) {
155175 GTEST_SKIP ();
@@ -203,6 +223,24 @@ void pow2AlignedAllocHelper(umf_memory_pool_handle_t pool) {
203223 ASSERT_EQ (umf_result, UMF_RESULT_SUCCESS);
204224 }
205225 }
226+
227+ // the same for size = 1
228+ for (size_t alignment = 1 ; alignment <= maxAlignment; alignment <<= 1 ) {
229+ std::vector<void *> allocs;
230+
231+ for (size_t alloc = 0 ; alloc < numAllocs; alloc++) {
232+ auto *ptr = umfPoolAlignedMalloc (pool, 1 , alignment);
233+ ASSERT_NE (ptr, nullptr );
234+ ASSERT_TRUE (reinterpret_cast <uintptr_t >(ptr) % alignment == 0 );
235+ *(reinterpret_cast <char *>(ptr)) = (char )0xFF ;
236+ allocs.push_back (ptr);
237+ }
238+
239+ for (auto &ptr : allocs) {
240+ umf_result_t umf_result = umfPoolFree (pool, ptr);
241+ ASSERT_EQ (umf_result, UMF_RESULT_SUCCESS);
242+ }
243+ }
206244}
207245
208246TEST_P (umfPoolTest, pow2AlignedAlloc) {
0 commit comments