diff --git a/include/mimalloc.h b/include/mimalloc.h index 1f12a41e..7ffb55d9 100644 --- a/include/mimalloc.h +++ b/include/mimalloc.h @@ -282,13 +282,13 @@ typedef struct mi_heap_area_s { size_t block_size; // size in bytes of each block } mi_heap_area_t; -// Information about a block +// Information about an allocated 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) + size_t allocated_size; // actual allocated size (only precise in debug mode with padding enabled) + bool valid; // is the block valid? (only detects heap overflow 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; diff --git a/src/heap.c b/src/heap.c index 338f0c0c..17498ba2 100644 --- a/src/heap.c +++ b/src/heap.c @@ -608,13 +608,13 @@ void mi_heap_print_json(mi_heap_t* heap, mi_output_fun* out, void* arg) { bool mi_heap_is_empty(mi_heap_t* heap) { if (heap==NULL) heap = mi_heap_get_default(); - mi_collect(false); + mi_heap_collect(heap,false); return (heap->page_count == 0); } void mi_heap_check_leak(mi_heap_t* heap, mi_output_fun* out, void* arg) { if (!mi_heap_is_empty(heap)) { - _mi_fprintf(out,arg,"mimalloc: potential memory leak detected. Current heap blocks:\n"); + _mi_fprintf(out,arg,"mimalloc: potential memory leak detected; current heap blocks:\n"); mi_heap_print_json(heap, out, arg); } }