mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-08 00:09:31 +03:00
Merge branch 'dev3-bin' of /Volumes/T9/dev/mimalloc into dev3-bin
This commit is contained in:
commit
3443dd01d9
1 changed files with 9 additions and 7 deletions
12
src/page.c
12
src/page.c
|
@ -175,7 +175,7 @@ static void mi_page_thread_free_collect(mi_page_t* page)
|
|||
mi_thread_free_t tfree = mi_atomic_load_relaxed(&page->xthread_free);
|
||||
do {
|
||||
head = mi_tf_block(tfree);
|
||||
if (head == NULL) return; // return if the list is empty
|
||||
if mi_likely(head == NULL) return; // return if the list is empty
|
||||
tfreex = mi_tf_create(NULL,mi_tf_is_owned(tfree)); // set the thread free list to NULL
|
||||
} while (!mi_atomic_cas_weak_acq_rel(&page->xthread_free, &tfree, tfreex)); // release is enough?
|
||||
mi_assert_internal(head != NULL);
|
||||
|
@ -718,13 +718,15 @@ static mi_decl_noinline mi_page_t* mi_page_queue_find_free_ex(mi_heap_t* heap, m
|
|||
#endif
|
||||
candidate_limit--;
|
||||
|
||||
// collect freed blocks by us and other threads
|
||||
_mi_page_free_collect(page, false);
|
||||
|
||||
// search up to N pages for a best candidate
|
||||
|
||||
// is the local free list non-empty?
|
||||
const bool immediate_available = mi_page_immediate_available(page);
|
||||
bool immediate_available = mi_page_immediate_available(page);
|
||||
if (!immediate_available) {
|
||||
// collect freed blocks by us and other threads to we get a proper use count
|
||||
_mi_page_free_collect(page, false);
|
||||
immediate_available = mi_page_immediate_available(page);
|
||||
}
|
||||
|
||||
// if the page is completely full, move it to the `mi_pages_full`
|
||||
// queue so we don't visit long-lived pages too often.
|
||||
|
|
Loading…
Add table
Reference in a new issue