Use allocate_aligned in cached implementation and the allocator_v1 testing utility to support overaligned types.

This commit is contained in:
Ion Gaztañaga
2026-01-13 23:39:37 +01:00
parent c9aa051025
commit d2ecb8937c
2 changed files with 5 additions and 2 deletions

View File

@@ -739,7 +739,8 @@ class cached_allocator_impl
ret = m_cache.cached_allocation();
}
else{
ret = this->get_segment_manager()->allocate(count*sizeof(T));
ret = this->get_segment_manager()->allocate_aligned
(count*sizeof(T), boost::container::dtl::alignment_of<T>::value);
}
return pointer(static_cast<T*>(ret));
}

View File

@@ -118,7 +118,9 @@ class allocator_v1
if(size_overflows<sizeof(T)>(count)){
throw bad_alloc();
}
(void)hint; return pointer(static_cast<T*>(mp_mngr->allocate(count*sizeof(T))));
(void)hint;
return pointer(static_cast<T*>
(mp_mngr->allocate_aligned(count*sizeof(T), , boost::container::dtl::alignment_of<T>::value)));
}
//!Deallocates memory previously allocated. Never throws