[PATCH] malloc: fix calculation of aligned heaps
Joern Engel
joern@purestorage.com
Tue Jan 26 00:32:00 GMT 2016
By my reading we would use the aligned_heap_area for every other
allocation while we should be able to use it for almost every
allocation.
JIRA: PURE-27597
---
tpc/malloc2.13/arena.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tpc/malloc2.13/arena.h b/tpc/malloc2.13/arena.h
index 7de7436a30ba..f6b108f661dc 100644
--- a/tpc/malloc2.13/arena.h
+++ b/tpc/malloc2.13/arena.h
@@ -543,8 +543,9 @@ static heap_info *new_heap(size_t size, size_t top_pad, int numa_node)
p2 = MAP_FAILED;
if (aligned_heap_area) {
p2 = mmap_for_heap(aligned_heap_area, HEAP_MAX_SIZE, &must_clear);
- aligned_heap_area = NULL;
+ aligned_heap_area = p2 + HEAP_MAX_SIZE;
if (p2 != MAP_FAILED && ((unsigned long)p2 & (HEAP_MAX_SIZE - 1))) {
+ aligned_heap_area = NULL;
munmap(p2, HEAP_MAX_SIZE);
p2 = MAP_FAILED;
}
--
2.7.0.rc3
More information about the Libc-alpha
mailing list