Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/mimalloc/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,8 @@ static inline size_t mi_page_block_size(const mi_page_t* page) {

// Page start
static inline uint8_t* mi_page_start(const mi_page_t* page) {
return (uint8_t*)page + (page->page_woffset * MI_SIZE_SIZE);
// multiplication must be done in `size_t`; in a 32-bit multiplication the offset wraps for pages whose blocks start 4 GiB or more after the page meta info
return (uint8_t*)page + ((size_t)page->page_woffset * MI_SIZE_SIZE);
}

static inline size_t mi_page_size(const mi_page_t* page) {
Expand Down
1 change: 0 additions & 1 deletion src/arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,6 @@ static bool mi_manage_os_memory_ex2(mi_subproc_t* subproc, void* start, size_t s
mi_memid_t memid, mi_commit_fun_t* commit_fun, void* commit_fun_arg, mi_arena_id_t* arena_id) mi_attr_noexcept
{
// checks
mi_assert(_mi_is_aligned(start, MI_ARENA_SLICE_SIZE));
mi_assert(start!=NULL);
if (arena_id != NULL) { *arena_id = _mi_arena_id_none(); }
if (start==NULL) return false;
Expand Down
8 changes: 5 additions & 3 deletions test/test-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,11 @@ int main(void) {
}
}

// CHECK_BODY("arena_reserve") {
// result = (0==mi_reserve_os_memory(16*MI_GiB,false,true));
// }
#if (MI_INTPTR_SIZE > 4)
CHECK_BODY("arena_reserve") {
result = (0==mi_reserve_os_memory(16*MI_GiB,false,true));
}
#endif

// ---------------------------------------------------
// Heaps
Expand Down