mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-16 02:42:23 +08:00
Align FastAllocator memory to 4096 for size >= 4096
This commit is contained in:
parent
54824ec71d
commit
5f64a0942f
@ -315,14 +315,14 @@ void* FastAllocator<Size>::allocate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_GPERFTOOLS) || defined(ADDRESS_SANITIZER)
|
#if defined(USE_GPERFTOOLS) || defined(ADDRESS_SANITIZER)
|
||||||
// Some usages of FastAllocator<4096> require 4096 byte alignment
|
// Some usages of FastAllocator require 4096 byte alignment.
|
||||||
return aligned_alloc(Size == 4096 ? Size : alignof(void*), Size);
|
return aligned_alloc(Size >= 4096 ? 4096 : alignof(void*), Size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if VALGRIND
|
#if VALGRIND
|
||||||
if (valgrindPrecise()) {
|
if (valgrindPrecise()) {
|
||||||
// Some usages of FastAllocator<4096> require 4096 byte alignment
|
// Some usages of FastAllocator require 4096 byte alignment
|
||||||
return aligned_alloc(Size == 4096 ? Size : alignof(void*), Size);
|
return aligned_alloc(Size >= 4096 ? 4096 : alignof(void*), Size);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user