diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-12-24 21:19:20 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-12-24 21:19:20 +0000 |
commit | 48576885c60208837ec07da027d9092f125e78eb (patch) | |
tree | af0bdbb1b9687f7312862adb3ed46bdc2148dfdf /malloc | |
parent | 3b6667a4abedaa82ff7392380ffecbe478ed3a69 (diff) | |
download | glibc-48576885c60208837ec07da027d9092f125e78eb.tar.gz glibc-48576885c60208837ec07da027d9092f125e78eb.tar.xz glibc-48576885c60208837ec07da027d9092f125e78eb.zip |
* malloc/malloc.c (sYSMALLOc): Remove some unnecessary alignment
attempts.
Diffstat (limited to 'malloc')
-rw-r--r-- | malloc/malloc.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index d15ed57bd7..6427608a79 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -2896,7 +2896,13 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av; is one SIZE_SZ unit larger than for normal chunks, because there is no following chunk whose prev_size field could be used. */ +#if 1 + /* See the front_misalign handling below, for glibc there is no + need for further alignments. */ + size = (nb + SIZE_SZ + pagemask) & ~pagemask; +#else size = (nb + SIZE_SZ + MALLOC_ALIGN_MASK + pagemask) & ~pagemask; +#endif tried_mmap = true; /* Don't try if size wraps around 0 */ @@ -2914,6 +2920,12 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av; address argument for later munmap in free() and realloc(). */ +#if 1 + /* For glibc, chunk2mem increases the address by 2*SIZE_SZ and + MALLOC_ALIGN_MASK is 2*SIZE_SZ-1. Each mmap'ed area is page + aligned and therefore definitely MALLOC_ALIGN_MASK-aligned. */ + assert (((INTERNAL_SIZE_T)chunk2mem(mm) & MALLOC_ALIGN_MASK) == 0); +#else front_misalign = (INTERNAL_SIZE_T)chunk2mem(mm) & MALLOC_ALIGN_MASK; if (front_misalign > 0) { correction = MALLOC_ALIGNMENT - front_misalign; @@ -2921,10 +2933,12 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av; p->prev_size = correction; set_head(p, (size - correction) |IS_MMAPPED); } - else { - p = (mchunkptr)mm; - set_head(p, size|IS_MMAPPED); - } + else +#endif + { + p = (mchunkptr)mm; + set_head(p, size|IS_MMAPPED); + } /* update statistics */ |