From b0e31a9ce35e3d3d47b59a21e7c43b0d41c11d11 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 4 Apr 2015 16:38:46 +0200 Subject: [PATCH] Revert "malloc_debug: align allocations". This reverts commit 217f090f9e247d1d4c5644e626642c430fafe4e5. At least for the guarded heap this completely defeats the purpose. If software requires a certain alignment it should request it using memalign explicitly instead of assuming it. --- src/system/libroot/posix/malloc_debug/guarded_heap.cpp | 4 ++-- src/system/libroot/posix/malloc_debug/heap.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/system/libroot/posix/malloc_debug/guarded_heap.cpp b/src/system/libroot/posix/malloc_debug/guarded_heap.cpp index 2d5600a962..2bb4f1936d 100644 --- a/src/system/libroot/posix/malloc_debug/guarded_heap.cpp +++ b/src/system/libroot/posix/malloc_debug/guarded_heap.cpp @@ -966,7 +966,7 @@ memalign(size_t alignment, size_t size) extern "C" void* malloc(size_t size) { - return memalign(size >= 8 ? 8 : 0, size); + return memalign(0, size); } @@ -987,7 +987,7 @@ realloc(void* address, size_t newSize) } if (address == NULL) - return memalign(size >= 8 ? 8 : 0, newSize); + return memalign(0, newSize); return guarded_heap_realloc(address, newSize); } diff --git a/src/system/libroot/posix/malloc_debug/heap.cpp b/src/system/libroot/posix/malloc_debug/heap.cpp index 699de22014..074cada0e0 100644 --- a/src/system/libroot/posix/malloc_debug/heap.cpp +++ b/src/system/libroot/posix/malloc_debug/heap.cpp @@ -1465,7 +1465,7 @@ heap_realloc(heap_allocator *heap, void *address, void **newAddress, newSize -= sizeof(addr_t) + sizeof(heap_leak_check_info); // if not, allocate a new chunk of memory - *newAddress = memalign(newSize >= 8 ? 8 : 0, newSize); + *newAddress = memalign(0, newSize); if (*newAddress == NULL) { // we tried but it didn't work out, but still the operation is done return B_OK; @@ -1937,7 +1937,7 @@ malloc(size_t size) if (sUseGuardPage) return heap_debug_malloc_with_guard_page(size); - return memalign(size >= 8 ? 8 : 0, size); + return memalign(0, size); } @@ -1978,7 +1978,7 @@ void * realloc(void *address, size_t newSize) { if (address == NULL) - return memalign(newSize >= 8 ? 8 : 0, newSize); + return memalign(0, newSize); if (newSize == 0) { free(address);