This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] malloc: fix calculation of aligned heaps


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]