mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
bug fixes
This commit is contained in:
parent
8f2a5864b8
commit
1d7a9f62a5
6 changed files with 34 additions and 32 deletions
17
src/arena.c
17
src/arena.c
|
@ -646,11 +646,12 @@ bool _mi_arena_try_reclaim(mi_heap_t* heap, mi_page_t* page) {
|
|||
// we only call this when on free (and thus there is still an object alive in the page)
|
||||
mi_memid_t memid = page->memid;
|
||||
if (!_mi_arena_memid_is_suitable(memid, heap->arena_id)) return false; // don't reclaim between exclusive and non-exclusive arena's
|
||||
if (mi_atomic_load_acquire(&page->xheap) != (uintptr_t)heap->tld->subproc) return false;
|
||||
|
||||
if mi_likely(memid.memkind == MI_MEM_ARENA) {
|
||||
size_t slice_index;
|
||||
mi_arena_t* arena = mi_page_arena(page, &slice_index, NULL);
|
||||
if (arena->subproc != heap->tld->subproc) return false; // only reclaim within the same subprocess
|
||||
//if (arena->subproc != heap->tld->subproc) return false; // only reclaim within the same subprocess
|
||||
|
||||
// don't reclaim more from a `free` call than half the current segments
|
||||
// this is to prevent a pure free-ing thread to start owning too many segments
|
||||
|
@ -665,6 +666,11 @@ bool _mi_arena_try_reclaim(mi_heap_t* heap, mi_page_t* page) {
|
|||
mi_assert_internal(!mi_page_is_abandoned(page));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (mi_page_is_abandoned(page)) {
|
||||
mi_assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// A page in OS or external memory
|
||||
|
@ -1089,15 +1095,6 @@ int mi_reserve_huge_os_pages(size_t pages, double max_secs, size_t* pages_reserv
|
|||
|
||||
|
||||
|
||||
/* -----------------------------------------------------------
|
||||
Abandoned pages
|
||||
----------------------------------------------------------- */
|
||||
|
||||
void mi_arena_page_abandon(mi_page_t* page) {
|
||||
mi_assert_internal(mi_page_is_abandoned(page));
|
||||
if (mi_page_is_full(page)) {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* -----------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue