Align FastAllocator memory to 4096 for size >= 4096

This commit is contained in:
Andrew Noyes 2021-03-16 00:35:13 +00:00
parent 54824ec71d
commit 5f64a0942f

View File

@ -315,14 +315,14 @@ void* FastAllocator<Size>::allocate() {
}
#if defined(USE_GPERFTOOLS) || defined(ADDRESS_SANITIZER)
// Some usages of FastAllocator<4096> require 4096 byte alignment
return aligned_alloc(Size == 4096 ? Size : alignof(void*), Size);
// Some usages of FastAllocator require 4096 byte alignment.
return aligned_alloc(Size >= 4096 ? 4096 : alignof(void*), Size);
#endif
#if VALGRIND
if (valgrindPrecise()) {
// Some usages of FastAllocator<4096> require 4096 byte alignment
return aligned_alloc(Size == 4096 ? Size : alignof(void*), Size);
// Some usages of FastAllocator require 4096 byte alignment
return aligned_alloc(Size >= 4096 ? 4096 : alignof(void*), Size);
}
#endif