mirror of
https://github.com/microsoft/mimalloc.git
synced 2024-12-30 23:43:39 +08:00
update whitespace and comments
This commit is contained in:
parent
7058e501cb
commit
f6109765d8
@ -122,7 +122,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
|||||||
#define MI_MEDIUM_OBJ_SIZE_MAX (MI_MEDIUM_PAGE_SIZE/4) // 128kb on 64-bit
|
#define MI_MEDIUM_OBJ_SIZE_MAX (MI_MEDIUM_PAGE_SIZE/4) // 128kb on 64-bit
|
||||||
#define MI_MEDIUM_OBJ_WSIZE_MAX (MI_MEDIUM_OBJ_SIZE_MAX/MI_INTPTR_SIZE) // 64kb on 64-bit
|
#define MI_MEDIUM_OBJ_WSIZE_MAX (MI_MEDIUM_OBJ_SIZE_MAX/MI_INTPTR_SIZE) // 64kb on 64-bit
|
||||||
|
|
||||||
#define MI_LARGE_OBJ_SIZE_MAX (MI_SEGMENT_SIZE/2) // 32mb on 64-bit
|
#define MI_LARGE_OBJ_SIZE_MAX (MI_SEGMENT_SIZE/2) // 4mb on 64-bit
|
||||||
#define MI_LARGE_OBJ_WSIZE_MAX (MI_LARGE_OBJ_SIZE_MAX/MI_INTPTR_SIZE)
|
#define MI_LARGE_OBJ_WSIZE_MAX (MI_LARGE_OBJ_SIZE_MAX/MI_INTPTR_SIZE)
|
||||||
|
|
||||||
#define MI_HUGE_OBJ_SIZE_MAX (2*MI_INTPTR_SIZE*MI_SEGMENT_SIZE) // (must match MI_REGION_MAX_ALLOC_SIZE in memory.c)
|
#define MI_HUGE_OBJ_SIZE_MAX (2*MI_INTPTR_SIZE*MI_SEGMENT_SIZE) // (must match MI_REGION_MAX_ALLOC_SIZE in memory.c)
|
||||||
|
@ -8,7 +8,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
"Arenas" are fixed area's of OS memory from which we can allocate
|
"Arenas" are fixed area's of OS memory from which we can allocate
|
||||||
large blocks (>= MI_ARENA_BLOCK_SIZE, 32MiB).
|
large blocks (>= MI_ARENA_BLOCK_SIZE, 8MiB).
|
||||||
In contrast to the rest of mimalloc, the arenas are shared between
|
In contrast to the rest of mimalloc, the arenas are shared between
|
||||||
threads and need to be accessed using atomic operations.
|
threads and need to be accessed using atomic operations.
|
||||||
|
|
||||||
@ -55,9 +55,9 @@ bool _mi_os_commit(void* p, size_t size, bool* is_zero, mi_stats_t* stats);
|
|||||||
// size in count of arena blocks.
|
// size in count of arena blocks.
|
||||||
typedef uintptr_t mi_block_info_t;
|
typedef uintptr_t mi_block_info_t;
|
||||||
#define MI_SEGMENT_ALIGN MI_SEGMENT_SIZE
|
#define MI_SEGMENT_ALIGN MI_SEGMENT_SIZE
|
||||||
#define MI_ARENA_BLOCK_SIZE MI_SEGMENT_ALIGN // 64MiB
|
#define MI_ARENA_BLOCK_SIZE MI_SEGMENT_ALIGN // 8MiB
|
||||||
#define MI_ARENA_MAX_OBJ_SIZE (MI_BITMAP_FIELD_BITS * MI_ARENA_BLOCK_SIZE) // 4GiB
|
#define MI_ARENA_MAX_OBJ_SIZE (MI_BITMAP_FIELD_BITS * MI_ARENA_BLOCK_SIZE) // 512MiB
|
||||||
#define MI_ARENA_MIN_OBJ_SIZE (MI_ARENA_BLOCK_SIZE/2) // 32MiB
|
#define MI_ARENA_MIN_OBJ_SIZE (MI_ARENA_BLOCK_SIZE/2) // 4MiB
|
||||||
#define MI_MAX_ARENAS (64) // not more than 256 (since we use 8 bits in the memid)
|
#define MI_MAX_ARENAS (64) // not more than 256 (since we use 8 bits in the memid)
|
||||||
|
|
||||||
// A memory arena descriptor
|
// A memory arena descriptor
|
||||||
|
10
src/region.c
10
src/region.c
@ -88,12 +88,12 @@ typedef union mi_region_info_u {
|
|||||||
typedef struct mem_region_s {
|
typedef struct mem_region_s {
|
||||||
_Atomic(uintptr_t) info; // mi_region_info_t.value
|
_Atomic(uintptr_t) info; // mi_region_info_t.value
|
||||||
_Atomic(void*) start; // start of the memory area
|
_Atomic(void*) start; // start of the memory area
|
||||||
mi_bitmap_field_t in_use; // bit per in-use block
|
mi_bitmap_field_t in_use; // bit per in-use block
|
||||||
mi_bitmap_field_t dirty; // track if non-zero per block
|
mi_bitmap_field_t dirty; // track if non-zero per block
|
||||||
mi_bitmap_field_t commit; // track if committed per block
|
mi_bitmap_field_t commit; // track if committed per block
|
||||||
mi_bitmap_field_t reset; // track if reset per block
|
mi_bitmap_field_t reset; // track if reset per block
|
||||||
_Atomic(uintptr_t) arena_memid; // if allocated from a (huge page) arena
|
_Atomic(uintptr_t) arena_memid; // if allocated from a (huge page) arena
|
||||||
uintptr_t padding; // round to 8 fields
|
uintptr_t padding; // round to 8 fields
|
||||||
} mem_region_t;
|
} mem_region_t;
|
||||||
|
|
||||||
// The region map
|
// The region map
|
||||||
|
Loading…
x
Reference in New Issue
Block a user