mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 15:29:31 +03:00
fix bug in page flag set that would keep pages abandoned
This commit is contained in:
parent
6137ae4ab8
commit
3f6d286a08
1 changed files with 4 additions and 3 deletions
|
@ -790,11 +790,12 @@ static inline void mi_page_set_has_aligned(mi_page_t* page, bool has_aligned) {
|
||||||
|
|
||||||
static inline void mi_page_set_heap(mi_page_t* page, mi_heap_t* heap) {
|
static inline void mi_page_set_heap(mi_page_t* page, mi_heap_t* heap) {
|
||||||
mi_assert_internal(!mi_page_is_in_full(page));
|
mi_assert_internal(!mi_page_is_in_full(page));
|
||||||
const mi_page_flags_t flags = mi_page_flags(page);
|
// only the aligned flag is retained (and in particular clear the abandoned-mapped flag).
|
||||||
const mi_threadid_t tid = (heap != NULL ? heap->tld->thread_id : 0) | flags; // for MI_PAGE_HAS_ALIGNED
|
const mi_page_flags_t flags = (mi_page_has_aligned(page) ? MI_PAGE_HAS_ALIGNED : 0);
|
||||||
|
const mi_threadid_t tid = (heap == NULL ? 0 : heap->tld->thread_id) | flags;
|
||||||
if (heap != NULL) {
|
if (heap != NULL) {
|
||||||
page->heap = heap;
|
page->heap = heap;
|
||||||
page->heap_tag = heap->tag;
|
page->heap_tag = heap->tag;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
page->heap = NULL;
|
page->heap = NULL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue