simplified aligned allocation; improved codegen; fix mi_good_size with padding included; add MI_MAX_ALIGN_GUARANTEE

This commit is contained in:
Daan
2024-05-11 06:43:52 -07:00
parent c70c1df16a
commit 7128db7bba
7 changed files with 69 additions and 55 deletions

View File

@@ -113,10 +113,10 @@ size_t _mi_bin_size(uint8_t bin) {
// Good size for allocation
size_t mi_good_size(size_t size) mi_attr_noexcept {
if (size <= MI_LARGE_OBJ_SIZE_MAX) {
return _mi_bin_size(mi_bin(size));
return _mi_bin_size(mi_bin(size + MI_PADDING_SIZE));
}
else {
return _mi_align_up(size,_mi_os_page_size());
return _mi_align_up(size + MI_PADDING_SIZE,_mi_os_page_size());
}
}