Submit #2832 ยป 0001-libc-nmalloc-Fix-realloc-bug-causing-lots-of-unneces.patch
lib/libc/stdlib/nmalloc.c | ||
---|---|---|
if (big->base == ptr) {
|
||
size = (size + PAGE_MASK) & ~(size_t)PAGE_MASK;
|
||
bigbytes = big->bytes;
|
||
if (bigbytes == size) {
|
||
/*
|
||
* We need to take the cache-coloring
|
||
* optimization into account. Also, if
|
||
* size is <= 2*PAGE_SIZE, _slaballoc wants
|
||
* to use the slab allocator instead of
|
||
* bigalloc.
|
||
*/
|
||
if (bigbytes == size ||
|
||
(size > 2*PAGE_SIZE && (size & 8191) == 0 &&
|
||
bigbytes == size + 4096)) {
|
||
bigalloc_unlock(ptr);
|
||
return(ptr);
|
||
}
|