diff options
author | daan <daanl@outlook.com> | 2021-12-17 11:40:46 -0800 |
---|---|---|
committer | daan <daanl@outlook.com> | 2021-12-17 11:40:46 -0800 |
commit | 684c2c82a795f527cff015ab1c6a32e8680cb165 (patch) | |
tree | 5e0093976d77fb48072cb92f63bc7a46ae23b502 /include/mimalloc.h | |
parent | 60790e9013eb8fe594cf7b3916baeae2cf03b03c (diff) |
restrict max aligment boundary to prevent bug with segment determination (found by Matthew Parkinson).
Diffstat (limited to 'include/mimalloc.h')
-rw-r--r-- | include/mimalloc.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/mimalloc.h b/include/mimalloc.h index 9c3e2de..b65027d 100644 --- a/include/mimalloc.h +++ b/include/mimalloc.h @@ -166,6 +166,7 @@ mi_decl_export void mi_process_info(size_t* elapsed_msecs, size_t* user_msecs, s // Note that `alignment` always follows `size` for consistency with unaligned // allocation, but unfortunately this differs from `posix_memalign` and `aligned_alloc`. // ------------------------------------------------------------------------------------- +#define MI_ALIGNED_MAX (1024*1024UL) // maximum supported alignment is 1MiB mi_decl_nodiscard mi_decl_export mi_decl_restrict void* mi_malloc_aligned(size_t size, size_t alignment) mi_attr_noexcept mi_attr_malloc mi_attr_alloc_size(1) mi_attr_alloc_align(2); mi_decl_nodiscard mi_decl_export mi_decl_restrict void* mi_malloc_aligned_at(size_t size, size_t alignment, size_t offset) mi_attr_noexcept mi_attr_malloc mi_attr_alloc_size(1); |