MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / main

Function main

3rd/mimalloc-2.0.9/test/main-override.c:8–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <mimalloc-override.h>
7
8int main() {
9 mi_version(); // ensure mimalloc library is linked
10 void* p1 = malloc(78);
11 void* p2 = malloc(24);
12 free(p1);
13 p1 = malloc(8);
14 //char* s = strdup("hello\n");
15 free(p2);
16 p2 = malloc(16);
17 p1 = realloc(p1, 32);
18 free(p1);
19 free(p2);
20 //free(s);
21 //mi_collect(true);
22
23 /* now test if override worked by allocating/freeing across the api's*/
24 //p1 = mi_malloc(32);
25 //free(p1);
26 //p2 = malloc(32);
27 //mi_free(p2);
28 p1 = malloc(24);
29 p2 = reallocarray(p1, 16, 16);
30 free(p2);
31 p1 = malloc(24);
32 assert(reallocarr(&p1, 16, 16) == 0);
33 free(p1);
34 mi_stats_print(NULL);
35 return 0;
36}

Callers

nothing calls this directly

Calls 4

mi_versionFunction · 0.85
reallocarrayFunction · 0.85
reallocarrFunction · 0.85
mi_stats_printFunction · 0.85

Tested by

no test coverage detected