Skip to content

Commit 09c658d

Browse files
committed
try to allocate within our hint space (partially addresses issue #360)
1 parent 0560fc2 commit 09c658d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ static mi_decl_cache_align _Atomic(uintptr_t) aligned_base;
585585
static void* mi_os_get_aligned_hint(size_t try_alignment, size_t size)
586586
{
587587
if (try_alignment == 0 || try_alignment > MI_SEGMENT_SIZE) return NULL;
588-
if ((size%MI_SEGMENT_SIZE) != 0) return NULL;
588+
size = _mi_align_up(size, MI_SEGMENT_SIZE);
589589
if (size > 1*MI_GiB) return NULL; // guarantee the chance of fixed valid address is at most 1/(KK_HINT_AREA / 1<<30) = 1/4096.
590590
#if (MI_SECURE>0)
591591
size += MI_SEGMENT_SIZE; // put in `MI_SEGMENT_SIZE` virtual gaps between hinted blocks; this splits VLA's but increases guarded areas.

0 commit comments

Comments
 (0)