From f4181f8d695cb4e2035f4469cfe34b87295bc2f9 Mon Sep 17 00:00:00 2001 From: githubzilla Date: Sat, 11 May 2024 10:10:21 +0000 Subject: [PATCH] Add mi_heap_page_utilization function --- src/alloc.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 51469d14..d431a862 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1064,24 +1064,6 @@ float mi_heap_page_utilization(mi_heap_t* heap, void* p) mi_attr_noexcept { return 1.0; } -bool mi_heap_page_is_underutilized(mi_heap_t* heap, void* p, float ratio) mi_attr_noexcept { - mi_page_t* page = _mi_ptr_page(p); // get the page that this belongs to - - mi_heap_t* page_heap = (mi_heap_t*)(mi_atomic_load_acquire(&(page)->xheap)); - - // the heap id matches and it is not a full page - if (mi_likely(page_heap == heap && page->flags.x.in_full == 0)) { - // first in the list, meaning it's the head of page queue, thus being used for malloc - if (page->prev == NULL) - return false; - - // this page belong to this heap and is not first in the page queue. Lets check its - // utilization. - return page->used <= (unsigned)(page->capacity * ratio); - } - return false; -} - // ------------------------------------------------------ // ensure explicit external inline definitions are emitted! // ------------------------------------------------------