Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>2022-08-30 16:56:26 +0300
committerJeff Johnston <jjohnstn@redhat.com>2022-09-01 22:39:10 +0300
commita68e99f8839e4697790077c8a77b506d528cc674 (patch)
treebd0b3c881e63248a696a8a6749e8ebb6322433b8
parent0455ea28ce2bfa83ca36ec37b9c9fb00c54bbe54 (diff)
Don't allocate another header when merging chunks
In the nano version of malloc, when the last chunk is to be extended, there is no need to acount for the header again as it's already taken into account in the overall "alloc_size" at the beginning of the function. Contributed by STMicroelectronics Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
-rw-r--r--newlib/libc/stdlib/nano-mallocr.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/newlib/libc/stdlib/nano-mallocr.c b/newlib/libc/stdlib/nano-mallocr.c
index 43eb20e07..b2273ba60 100644
--- a/newlib/libc/stdlib/nano-mallocr.c
+++ b/newlib/libc/stdlib/nano-mallocr.c
@@ -328,10 +328,6 @@ void * nano_malloc(RARG malloc_size_t s)
/* The last free item has the heap end as neighbour.
* Let's ask for a smaller amount and merge */
alloc_size -= p->size;
- alloc_size = ALIGN_SIZE(alloc_size, CHUNK_ALIGN); /* size of aligned data load */
- alloc_size += MALLOC_PADDING; /* padding */
- alloc_size += CHUNK_OFFSET; /* size of chunk head */
- alloc_size = MAX(alloc_size, MALLOC_MINCHUNK);
if (sbrk_aligned(RCALL alloc_size) != (void *)-1)
{