Skip to content

Commit 6c5d6e1

Browse files
committed
fix max allocation size on 32-bit systems (issue #882)
1 parent 3b4c61b commit 6c5d6e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/mimalloc/types.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ typedef int32_t mi_ssize_t;
214214

215215
// we never allocate more than PTRDIFF_MAX (see also <https://sourceware.org/ml/libc-announce/2019/msg00001.html>)
216216
// on 64-bit+ systems we also limit the maximum allocation size such that the slice count fits in 32-bits. (issue #877)
217-
#if PTRDIFF_MAX >= (MI_SEGMENT_SLIZE_SIZE * UINT32_MAX)
217+
#if (PTRDIFF_MAX > INT32_MAX) && (PTRDIFF_MAX >= (MI_SEGMENT_SLIZE_SIZE * UINT32_MAX))
218218
#define MI_MAX_ALLOC_SIZE (MI_SEGMENT_SLICE_SIZE * (UINT32_MAX-1))
219219
#else
220220
#define MI_MAX_ALLOC_SIZE PTRDIFF_MAX

0 commit comments

Comments
 (0)