mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-07 20:08:41 +03:00
initial sources for vcpkg support
This commit is contained in:
parent
3f91c9f937
commit
4e5a6d2136
5 changed files with 176 additions and 0 deletions
21
contrib/vcpkg/usage
Normal file
21
contrib/vcpkg/usage
Normal file
|
@ -0,0 +1,21 @@
|
|||
Use the following CMake targets to import mimalloc:
|
||||
|
||||
find_package(mimalloc CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE mimalloc)
|
||||
|
||||
And use mimalloc in your sources as:
|
||||
|
||||
#include <mimalloc.h>
|
||||
#include <stdio.h>
|
||||
int main(int argc, char** argv) {
|
||||
int* p = mi_malloc_tp(int);
|
||||
*p = mi_version();
|
||||
printf("mimalloc version: %d\n", *p);
|
||||
mi_free(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
When dynamically overriding on Windows, ensure `mimalloc.dll` is linked
|
||||
through some call to the mimalloc API, e.g. `mi_version()`, and that
|
||||
the `mimalloc-redirect.dll` is in the same directory.
|
||||
See https://github.com/microsoft/mimalloc/blob/dev/bin/readme.md for detailed information.
|
Loading…
Add table
Add a link
Reference in a new issue