mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 11:34:38 +03:00
initial checkin
This commit is contained in:
parent
23b4e65faa
commit
26a874eb3f
41 changed files with 11897 additions and 0 deletions
35
test/main.c
Normal file
35
test/main.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <mimalloc.h>
|
||||
|
||||
void test_heap(void* p_out) {
|
||||
mi_heap_t* heap = mi_heap_new();
|
||||
void* p1 = mi_heap_malloc(heap,32);
|
||||
void* p2 = mi_heap_malloc(heap,48);
|
||||
mi_free(p_out);
|
||||
mi_heap_destroy(heap);
|
||||
//mi_heap_delete(heap); mi_free(p1); mi_free(p2);
|
||||
}
|
||||
|
||||
int main() {
|
||||
void* p1 = mi_malloc(16);
|
||||
void* p2 = mi_malloc(1000000);
|
||||
mi_free(p1);
|
||||
mi_free(p2);
|
||||
p1 = mi_malloc(16);
|
||||
p2 = mi_malloc(16);
|
||||
mi_free(p1);
|
||||
mi_free(p2);
|
||||
|
||||
test_heap(mi_malloc(32));
|
||||
|
||||
p1 = mi_malloc_aligned(64, 16);
|
||||
p2 = mi_malloc_aligned(160,24);
|
||||
mi_free(p2);
|
||||
mi_free(p1);
|
||||
|
||||
mi_collect(true);
|
||||
mi_stats_print(NULL);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue