mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-04 22:49:32 +03:00
Add branch hint for _mi_os_good_alloc_size
In _mi_os_good_alloc_size, overflow caused by alignment size is rare, and this patch added the appropriate branch hint during range checks.
This commit is contained in:
parent
e2c095fad2
commit
d48c93af2c
1 changed files with 1 additions and 1 deletions
2
src/os.c
2
src/os.c
|
@ -113,7 +113,7 @@ size_t _mi_os_good_alloc_size(size_t size) {
|
|||
else if (size < 8*MiB) align_size = 256*KiB;
|
||||
else if (size < 32*MiB) align_size = 1*MiB;
|
||||
else align_size = 4*MiB;
|
||||
if (size >= (SIZE_MAX - align_size)) return size; // possible overflow?
|
||||
if (mi_unlikely(size >= (SIZE_MAX - align_size))) return size; // possible overflow?
|
||||
return _mi_align_up(size, align_size);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue