alloc_jemalloc: don’t assume MIN_ALIGN for small sizes

See previous commit’s message for what is expected of allocators
in general, and https://github.com/jemalloc/jemalloc/issues/1072
for discussion of what jemalloc does specifically.
This commit is contained in:
Simon Sapin
2017-11-20 15:42:34 +01:00
parent 21d899272a
commit 2dd268b652
2 changed files with 16 additions and 11 deletions

View File

@@ -20,6 +20,11 @@ fn alloc_system_overaligned_request() {
check_overalign_requests(System)
}
#[test]
fn std_heap_overaligned_request() {
check_overalign_requests(Heap)
}
fn check_overalign_requests<T: Alloc>(mut allocator: T) {
let size = 8;
let align = 16; // greater than size