- Modify dlmalloc_allocation_command to use alignment info, this requires modifying the dlmalloc_ext wrapper library.

- Replace all dlmalloc_malloc uses with dlmalloc_allocation_command to support overaligned types in array allocations.
This commit is contained in:
Ion Gaztañaga
2026-01-19 01:06:56 +01:00
parent 1e1741ce63
commit 9201bbf83b
10 changed files with 49 additions and 29 deletions

View File

@@ -112,10 +112,9 @@ struct GetAllocatorCont
template<class ValueType>
struct apply
{
typedef vector< ValueType
, typename allocator_traits<VoidAllocator>
::template portable_rebind_alloc<ValueType>::type
> type;
typedef typename allocator_traits<VoidAllocator>
::template portable_rebind_alloc<ValueType>::type rebound_allocator_type;
typedef vector< ValueType, rebound_allocator_type> type;
};
};
@@ -127,6 +126,7 @@ int test_cont_variants()
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_and_copyable_int>::type MyCopyMoveCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::copyable_int>::type MyCopyCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::moveconstruct_int>::type MyMoveConstructCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::overaligned_copyable_int>::type MyOverAlignCont;
if (test::vector_test<MyCont>())
return 1;
@@ -138,7 +138,11 @@ int test_cont_variants()
return 1;
if (test::vector_test<MyMoveConstructCont>())
return 1;
#if !defined(__cpp_aligned_new) //old std::allocators don't support overaligned types
BOOST_IF_CONSTEXPR(!dtl::is_same<typename MyCont::allocator_type, std::allocator<int> >::value)
#endif
if (test::vector_test<MyOverAlignCont>())
return 1;
return 0;
}
@@ -276,6 +280,11 @@ int main()
std::cerr << "test_cont_variants< allocator<void> > failed" << std::endl;
return 1;
}
// boost::container::new_allocator
if(test_cont_variants< new_allocator<void> >()){
std::cerr << "test_cont_variants< allocator<void> > failed" << std::endl;
return 1;
}
{ //Test enum container
typedef vector<Test, std::allocator<Test> > MyEnumCont;