From 4a14c69554f7d07cc72d8b99f4322990c9cd2696 Mon Sep 17 00:00:00 2001 From: daanx Date: Wed, 15 Jan 2025 12:11:52 -0800 Subject: [PATCH 1/2] disable using vcpkg in the VS projects --- ide/vs2022/mimalloc-lib.vcxproj | 3 +++ ide/vs2022/mimalloc-override-dll.vcxproj | 3 +++ ide/vs2022/mimalloc-override-test-dep.vcxproj | 3 +++ ide/vs2022/mimalloc-override-test.vcxproj | 3 +++ ide/vs2022/mimalloc-test-api.vcxproj | 3 +++ ide/vs2022/mimalloc-test-stress.vcxproj | 3 +++ ide/vs2022/mimalloc-test.vcxproj | 3 +++ 7 files changed, 21 insertions(+) diff --git a/ide/vs2022/mimalloc-lib.vcxproj b/ide/vs2022/mimalloc-lib.vcxproj index 3359e6c0..c6c2cb5f 100644 --- a/ide/vs2022/mimalloc-lib.vcxproj +++ b/ide/vs2022/mimalloc-lib.vcxproj @@ -164,6 +164,9 @@ .lib mimalloc + + false + Level4 diff --git a/ide/vs2022/mimalloc-override-dll.vcxproj b/ide/vs2022/mimalloc-override-dll.vcxproj index d80d0b02..133b3efa 100644 --- a/ide/vs2022/mimalloc-override-dll.vcxproj +++ b/ide/vs2022/mimalloc-override-dll.vcxproj @@ -160,6 +160,9 @@ .dll mimalloc + + false + Level3 diff --git a/ide/vs2022/mimalloc-override-test-dep.vcxproj b/ide/vs2022/mimalloc-override-test-dep.vcxproj index 606bec9c..c1b89690 100644 --- a/ide/vs2022/mimalloc-override-test-dep.vcxproj +++ b/ide/vs2022/mimalloc-override-test-dep.vcxproj @@ -148,6 +148,9 @@ $(ProjectDir)..\..\out\msvc-$(Platform)\$(Configuration)\ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\ + + false + Level3 diff --git a/ide/vs2022/mimalloc-override-test.vcxproj b/ide/vs2022/mimalloc-override-test.vcxproj index ae465349..1dc2cee7 100644 --- a/ide/vs2022/mimalloc-override-test.vcxproj +++ b/ide/vs2022/mimalloc-override-test.vcxproj @@ -148,6 +148,9 @@ $(ProjectDir)..\..\out\msvc-$(Platform)\$(Configuration)\ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\ + + false + Level3 diff --git a/ide/vs2022/mimalloc-test-api.vcxproj b/ide/vs2022/mimalloc-test-api.vcxproj index b7f97ad2..440693a2 100644 --- a/ide/vs2022/mimalloc-test-api.vcxproj +++ b/ide/vs2022/mimalloc-test-api.vcxproj @@ -148,6 +148,9 @@ $(ProjectDir)..\..\out\msvc-$(Platform)\$(Configuration)\ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\ + + false + Level3 diff --git a/ide/vs2022/mimalloc-test-stress.vcxproj b/ide/vs2022/mimalloc-test-stress.vcxproj index cb761f94..d6af71ce 100644 --- a/ide/vs2022/mimalloc-test-stress.vcxproj +++ b/ide/vs2022/mimalloc-test-stress.vcxproj @@ -148,6 +148,9 @@ $(ProjectDir)..\..\out\msvc-$(Platform)\$(Configuration)\ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\ + + false + Level3 diff --git a/ide/vs2022/mimalloc-test.vcxproj b/ide/vs2022/mimalloc-test.vcxproj index 83202dbe..1e41fca1 100644 --- a/ide/vs2022/mimalloc-test.vcxproj +++ b/ide/vs2022/mimalloc-test.vcxproj @@ -148,6 +148,9 @@ $(ProjectDir)..\..\out\msvc-$(Platform)\$(Configuration)\ $(ProjectDir)..\..\out\msvc-$(Platform)\$(ProjectName)\$(Configuration)\ + + false + Level3 From 2bc52557c59cb67fdb53f9d10600c059b4818d19 Mon Sep 17 00:00:00 2001 From: daanx Date: Wed, 15 Jan 2025 12:31:35 -0800 Subject: [PATCH 2/2] add figure to readme for mimalloc-redirect --- bin/readme.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bin/readme.md b/bin/readme.md index 926f25df..2815f168 100644 --- a/bin/readme.md +++ b/bin/readme.md @@ -25,6 +25,23 @@ There are four requirements to make the overriding work well: list of the final executable (so it can intercept all potential allocations). You can use `minject -l ` to check this if needed. +```cpp +┌──────────────┐ +│ Your Program │ +└────┬─────────┘ + │ + │ mi_version() ┌───────────────┐ ┌───────────────────────┐ + ├──────────────►│ mimalloc.dll ├────►│ mimalloc-redirect.dll │ + │ └──────┬────────┘ └───────────────────────┘ + │ ▼ + │ malloc() etc. ┌──────────────┐ + ├──────────────►│ ucrtbase.dll │ + │ └──────────────┘ + │ + │ + └──────────────► ... +``` + For best performance on Windows with C++, it is also recommended to also override the `new`/`delete` operations (by including [`mimalloc-new-delete.h`](../include/mimalloc-new-delete.h)