mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 15:29:31 +03:00
search regions always from the lowest index
This commit is contained in:
parent
8b06ab1e49
commit
3d8c331a1c
1 changed files with 1 additions and 1 deletions
|
@ -318,7 +318,7 @@ void* _mi_mem_alloc_aligned(size_t size, size_t alignment, bool commit, size_t*
|
||||||
// find a range of free blocks
|
// find a range of free blocks
|
||||||
void* p = NULL;
|
void* p = NULL;
|
||||||
size_t count = mi_atomic_read(®ions_count);
|
size_t count = mi_atomic_read(®ions_count);
|
||||||
size_t idx = tld->region_idx; // start index is per-thread to reduce contention
|
size_t idx = 0; // tld->region_idx; // start index is per-thread to reduce contention
|
||||||
for (size_t visited = 0; visited < count; visited++, idx++) {
|
for (size_t visited = 0; visited < count; visited++, idx++) {
|
||||||
if (idx >= count) idx = 0; // wrap around
|
if (idx >= count) idx = 0; // wrap around
|
||||||
if (!mi_region_try_alloc_blocks(idx, blocks, size, commit, &p, id, tld)) return NULL; // error
|
if (!mi_region_try_alloc_blocks(idx, blocks, size, commit, &p, id, tld)) return NULL; // error
|
||||||
|
|
Loading…
Add table
Reference in a new issue