2019-06-20 02:26:12 +03:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2019-07-22 11:36:16 +03:00
|
|
|
#include <mimalloc.h>
|
2019-06-20 02:26:12 +03:00
|
|
|
|
|
|
|
int main() {
|
2019-07-22 11:36:16 +03:00
|
|
|
mi_version(); // ensure mimalloc library is linked
|
2019-06-20 02:26:12 +03:00
|
|
|
void* p1 = malloc(78);
|
|
|
|
void* p2 = malloc(24);
|
|
|
|
free(p1);
|
|
|
|
p1 = malloc(8);
|
2019-07-19 04:59:32 +03:00
|
|
|
//char* s = strdup("hello\n");
|
2019-06-20 02:26:12 +03:00
|
|
|
free(p2);
|
|
|
|
p2 = malloc(16);
|
|
|
|
p1 = realloc(p1, 32);
|
|
|
|
free(p1);
|
|
|
|
free(p2);
|
2019-07-19 04:59:32 +03:00
|
|
|
//free(s);
|
|
|
|
//mi_collect(true);
|
2019-06-27 23:34:50 +03:00
|
|
|
|
|
|
|
/* now test if override worked by allocating/freeing across the api's*/
|
2019-07-19 04:59:32 +03:00
|
|
|
//p1 = mi_malloc(32);
|
|
|
|
//free(p1);
|
|
|
|
//p2 = malloc(32);
|
|
|
|
//mi_free(p2);
|
2019-07-22 11:36:16 +03:00
|
|
|
mi_stats_print(NULL);
|
2019-06-20 02:26:12 +03:00
|
|
|
return 0;
|
|
|
|
}
|