mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
add more detailed block info for heap visiting
This commit is contained in:
parent
120af372ab
commit
173978c122
5 changed files with 89 additions and 12 deletions
|
@ -148,6 +148,7 @@ mi_block_t* _mi_page_ptr_unalign(const mi_segment_t* segment, const mi_page_t* p
|
|||
bool _mi_free_delayed_block(mi_block_t* block);
|
||||
void _mi_block_zero_init(const mi_page_t* page, void* p, size_t size);
|
||||
size_t _mi_path_max(void);
|
||||
void _mi_page_block_info(const mi_page_t* page, const mi_block_t* block, mi_block_info_t* info);
|
||||
|
||||
mi_decl_restrict void* _mi_base_malloc_zero(mi_heap_t* heap, size_t size, bool zero MI_SOURCE_XPARAM) mi_attr_malloc mi_attr_alloc_size(2);
|
||||
void* _mi_base_realloc_zero(mi_heap_t* heap, void* p, size_t newsize, bool zero MI_SOURCE_XPARAM) mi_attr_alloc_size(2);
|
||||
|
|
|
@ -282,7 +282,17 @@ typedef struct mi_heap_area_s {
|
|||
size_t block_size; // size in bytes of each block
|
||||
} mi_heap_area_t;
|
||||
|
||||
typedef bool (mi_cdecl mi_block_visit_fun)(const mi_heap_t* heap, const mi_heap_area_t* area, void* block, size_t block_size, void* arg);
|
||||
// Information about a block
|
||||
typedef struct mi_block_info_s {
|
||||
void* block; // start of the block
|
||||
size_t size; // full size including padding etc.
|
||||
size_t usable_size; // usable size (available for in-place realloc)
|
||||
size_t allocated_size; // actual allocated size (only precise in debug mode with padding)
|
||||
bool valid; // is the block valid? (only detects corrupt blocks with padding enabled)
|
||||
mi_source_t source; // the source location that allocated this block (only valid in debug mode with padding)
|
||||
} mi_block_info_t;
|
||||
|
||||
typedef bool (mi_cdecl mi_block_visit_fun)(const mi_heap_t* heap, const mi_heap_area_t* area, const mi_block_info_t* block_info, void* arg);
|
||||
|
||||
mi_decl_export bool mi_heap_visit_blocks(const mi_heap_t* heap, bool visit_all_blocks, mi_block_visit_fun* visitor, void* arg);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue