You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
442 B
18 lines
442 B
|
2 days ago
|
#include <mimalloc.h>
|
||
|
|
#include <stdio.h>
|
||
|
|
#include <stdlib.h>
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
// 使用标准的C接口分配内存
|
||
|
|
void* p = malloc(128);
|
||
|
|
|
||
|
|
// 检查这块内存是否属于mimalloc管理
|
||
|
|
if (mi_heap_of(p) != NULL) {
|
||
|
|
printf("✅ 重定向成功!标准malloc已经被mimalloc接管\n");
|
||
|
|
} else {
|
||
|
|
printf("❌ 重定向失败,内存仍由系统分配器管理\n");
|
||
|
|
}
|
||
|
|
|
||
|
|
free(p);
|
||
|
|
return 0;
|
||
|
|
}
|