mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
merge from dev
This commit is contained in:
commit
774d12f12e
3 changed files with 28 additions and 7 deletions
|
@ -18,6 +18,7 @@ static void test_process_info(void);
|
|||
static void test_reserved(void);
|
||||
static void negative_stat(void);
|
||||
static void alloc_huge(void);
|
||||
static void test_heap_walk(void);
|
||||
|
||||
int main() {
|
||||
mi_version();
|
||||
|
@ -31,7 +32,8 @@ int main() {
|
|||
// invalid_free();
|
||||
// test_reserved();
|
||||
// negative_stat();
|
||||
alloc_huge();
|
||||
// alloc_huge();
|
||||
test_heap_walk();
|
||||
|
||||
void* p1 = malloc(78);
|
||||
void* p2 = malloc(24);
|
||||
|
@ -51,8 +53,10 @@ int main() {
|
|||
//free(p1);
|
||||
//p2 = malloc(32);
|
||||
//mi_free(p2);
|
||||
mi_collect(true);
|
||||
mi_stats_print(NULL);
|
||||
|
||||
//mi_collect(true);
|
||||
//mi_stats_print(NULL);
|
||||
|
||||
// test_process_info();
|
||||
return 0;
|
||||
}
|
||||
|
@ -189,6 +193,19 @@ static void alloc_huge(void) {
|
|||
mi_free(p);
|
||||
}
|
||||
|
||||
static bool test_visit(const mi_heap_t* heap, const mi_heap_area_t* area, void* block, size_t block_size, void* arg) {
|
||||
printf("I'm visiting a block of size %zu, allocated size %zu\n", block_size, mi_usable_size(block));
|
||||
return true;
|
||||
}
|
||||
|
||||
static void test_heap_walk(void) {
|
||||
mi_heap_t* heap = mi_heap_new();
|
||||
//mi_heap_malloc(heap, 2097152);
|
||||
mi_heap_malloc(heap, 2067152);
|
||||
mi_heap_malloc(heap, 2097160);
|
||||
mi_heap_malloc(heap, 24576);
|
||||
mi_heap_visit_blocks(heap, true, &test_visit, NULL);
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// bin size experiments
|
||||
|
@ -360,4 +377,4 @@ static void mi_bins(void) {
|
|||
last_bsize = bsize;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue