mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-08-24 16:24:47 +03:00
wip
This commit is contained in:
parent
f8d04dc2bc
commit
55b70f1588
7 changed files with 27 additions and 23 deletions
|
@ -9,7 +9,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
|||
#include "mimalloc/internal.h"
|
||||
#include "bitmap.h"
|
||||
|
||||
mi_decl_cache_align signed char* _mi_page_map = NULL;
|
||||
mi_decl_cache_align uint8_t* _mi_page_map = NULL;
|
||||
static bool mi_page_map_all_committed = false;
|
||||
static size_t mi_page_map_entries_per_commit_bit = MI_ARENA_SLICE_SIZE;
|
||||
static mi_memid_t mi_page_map_memid;
|
||||
|
@ -25,7 +25,7 @@ static bool mi_page_map_init(void) {
|
|||
mi_page_map_entries_per_commit_bit = _mi_divide_up(page_map_size,MI_BITMAP_MAX_BITS);
|
||||
|
||||
mi_page_map_all_committed = _mi_os_has_overcommit(); // commit on-access on Linux systems
|
||||
_mi_page_map = (int8_t*)_mi_os_alloc_aligned(page_map_size, 1, mi_page_map_all_committed, true, &mi_page_map_memid, NULL);
|
||||
_mi_page_map = (uint8_t*)_mi_os_alloc_aligned(page_map_size, 1, mi_page_map_all_committed, true, &mi_page_map_memid, NULL);
|
||||
if (_mi_page_map==NULL) {
|
||||
_mi_error_message(ENOMEM, "unable to reserve virtual memory for the page map (%zu KiB)\n", page_map_size / MI_KiB);
|
||||
return false;
|
||||
|
@ -81,7 +81,7 @@ void _mi_page_map_register(mi_page_t* page) {
|
|||
// set the offsets
|
||||
for (int i = 0; i < (int)slice_count; i++) {
|
||||
mi_assert_internal(i < 128);
|
||||
_mi_page_map[idx + i] = (signed char)(-i-1);
|
||||
_mi_page_map[idx + i] = (i+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue