This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] malloc: fix calculation of aligned heaps
- From: Joern Engel <joern at purestorage dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Cc: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>, Joern Engel <joern at purestorage dot com>
- Date: Mon, 25 Jan 2016 16:25:34 -0800
- Subject: [PATCH] malloc: fix calculation of aligned heaps
- Authentication-results: sourceware.org; auth=none
- References: <1453767942-19369-1-git-send-email-joern at purestorage dot com>
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