mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 23:39:31 +03:00
small fixes
This commit is contained in:
parent
bc7fe399b1
commit
45f7fb559a
3 changed files with 12 additions and 4 deletions
|
@ -487,7 +487,7 @@ static inline mi_page_t* _mi_checked_ptr_page(const void* p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline mi_page_t* _mi_ptr_page(const void* p) {
|
static inline mi_page_t* _mi_ptr_page(const void* p) {
|
||||||
#if 1 // MI_DEBUG
|
#if MI_DEBUG
|
||||||
return _mi_checked_ptr_page(p);
|
return _mi_checked_ptr_page(p);
|
||||||
#else
|
#else
|
||||||
return _mi_ptr_page_ex(p,NULL);
|
return _mi_ptr_page_ex(p,NULL);
|
||||||
|
@ -638,6 +638,13 @@ static inline bool mi_page_is_mostly_used(const mi_page_t* page) {
|
||||||
return (page->reserved - page->used <= frac);
|
return (page->reserved - page->used <= frac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// is less than 1/n'th of a page free?
|
||||||
|
static inline bool mi_page_is_used_at_frac(const mi_page_t* page, uint16_t n) {
|
||||||
|
if (page==NULL) return true;
|
||||||
|
uint16_t frac = page->reserved / n;
|
||||||
|
return (page->reserved - page->used <= frac);
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool mi_page_is_abandoned(const mi_page_t* page) {
|
static inline bool mi_page_is_abandoned(const mi_page_t* page) {
|
||||||
// note: the xheap field of an abandoned heap is set to the subproc (for fast reclaim-on-free)
|
// note: the xheap field of an abandoned heap is set to the subproc (for fast reclaim-on-free)
|
||||||
return (mi_atomic_load_acquire(&page->xthread_id) <= 1);
|
return (mi_atomic_load_acquire(&page->xthread_id) <= 1);
|
||||||
|
|
|
@ -51,8 +51,9 @@ typedef uint32_t mi_cmap_t;
|
||||||
typedef mi_decl_align(MI_BITMAP_CHUNK_SIZE) struct mi_bitmap_s {
|
typedef mi_decl_align(MI_BITMAP_CHUNK_SIZE) struct mi_bitmap_s {
|
||||||
_Atomic(size_t) chunk_map_count;
|
_Atomic(size_t) chunk_map_count;
|
||||||
_Atomic(size_t) chunk_count;
|
_Atomic(size_t) chunk_count;
|
||||||
|
size_t padding[MI_BITMAP_CHUNK_SIZE/MI_SIZE_SIZE - 2]; // suppress warning on msvc
|
||||||
_Atomic(mi_chunkmap_t) chunk_maps[MI_BITMAP_MAX_CHUNKMAPS];
|
_Atomic(mi_chunkmap_t) chunk_maps[MI_BITMAP_MAX_CHUNKMAPS];
|
||||||
// padding
|
|
||||||
mi_bitmap_chunk_t chunks[MI_BITMAP_MIN_BIT_COUNT]; // or more, up to MI_BITMAP_MAX_CHUNK_COUNT
|
mi_bitmap_chunk_t chunks[MI_BITMAP_MIN_BIT_COUNT]; // or more, up to MI_BITMAP_MAX_CHUNK_COUNT
|
||||||
} mi_bitmap_t;
|
} mi_bitmap_t;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ static int THREADS = 1;
|
||||||
static int SCALE = 100;
|
static int SCALE = 100;
|
||||||
static int ITER = 10;
|
static int ITER = 10;
|
||||||
#define ALLOW_LARGE false
|
#define ALLOW_LARGE false
|
||||||
#elif 0
|
#elif 1
|
||||||
static int THREADS = 32;
|
static int THREADS = 32;
|
||||||
static int SCALE = 50;
|
static int SCALE = 50;
|
||||||
static int ITER = 50;
|
static int ITER = 50;
|
||||||
|
|
Loading…
Add table
Reference in a new issue