diff --git a/CMakeLists.txt b/CMakeLists.txt
index caba7d80..55db7232 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -172,6 +172,7 @@ install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_dir} LIBRARY N
install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_dir})
install(FILES include/mimalloc.h DESTINATION ${mi_install_dir}/include)
install(FILES include/mimalloc-override.h DESTINATION ${mi_install_dir}/include)
+install(FILES include/mimalloc-new-delete.h DESTINATION ${mi_install_dir}/include)
install(FILES cmake/mimalloc-config.cmake DESTINATION ${mi_install_dir}/cmake)
install(FILES cmake/mimalloc-config-version.cmake DESTINATION ${mi_install_dir}/cmake)
install(EXPORT mimalloc DESTINATION ${mi_install_dir}/cmake)
diff --git a/ide/vs2017/mimalloc-override.vcxproj b/ide/vs2017/mimalloc-override.vcxproj
index ffa14a54..511c0fab 100644
--- a/ide/vs2017/mimalloc-override.vcxproj
+++ b/ide/vs2017/mimalloc-override.vcxproj
@@ -212,6 +212,7 @@
+
diff --git a/ide/vs2017/mimalloc-override.vcxproj.filters b/ide/vs2017/mimalloc-override.vcxproj.filters
index ffabddac..6ac0c0b5 100644
--- a/ide/vs2017/mimalloc-override.vcxproj.filters
+++ b/ide/vs2017/mimalloc-override.vcxproj.filters
@@ -26,6 +26,9 @@
Header Files
+
+ Header Files
+
diff --git a/ide/vs2017/mimalloc.vcxproj b/ide/vs2017/mimalloc.vcxproj
index 854bf921..6147c349 100644
--- a/ide/vs2017/mimalloc.vcxproj
+++ b/ide/vs2017/mimalloc.vcxproj
@@ -238,6 +238,7 @@
+
diff --git a/ide/vs2017/mimalloc.vcxproj.filters b/ide/vs2017/mimalloc.vcxproj.filters
index 28d94e99..a2b64314 100644
--- a/ide/vs2017/mimalloc.vcxproj.filters
+++ b/ide/vs2017/mimalloc.vcxproj.filters
@@ -70,5 +70,8 @@
Header Files
+
+ Header Files
+
\ No newline at end of file
diff --git a/ide/vs2019/mimalloc-override.vcxproj b/ide/vs2019/mimalloc-override.vcxproj
index c651879f..96a8924f 100644
--- a/ide/vs2019/mimalloc-override.vcxproj
+++ b/ide/vs2019/mimalloc-override.vcxproj
@@ -212,6 +212,7 @@
+
diff --git a/ide/vs2019/mimalloc.vcxproj b/ide/vs2019/mimalloc.vcxproj
index 7e74d881..5658b536 100644
--- a/ide/vs2019/mimalloc.vcxproj
+++ b/ide/vs2019/mimalloc.vcxproj
@@ -238,6 +238,7 @@
+
diff --git a/include/mimalloc-new-delete.h b/include/mimalloc-new-delete.h
new file mode 100644
index 00000000..050f9433
--- /dev/null
+++ b/include/mimalloc-new-delete.h
@@ -0,0 +1,52 @@
+/* ----------------------------------------------------------------------------
+Copyright (c) 2018,2019 Microsoft Research, Daan Leijen
+This is free software; you can redistribute it and/or modify it under the
+terms of the MIT license. A copy of the license can be found in the file
+"LICENSE" at the root of this distribution.
+-----------------------------------------------------------------------------*/
+#pragma once
+#ifndef MIMALLOC_NEW_DELETE_H
+#define MIMALLOC_NEW_DELETE_H
+
+// ----------------------------------------------------------------------------
+// This header provides convenient overrides for the new and
+// delete operations in C++.
+//
+// This header should be included in only one source file!
+//
+// On Windows, or when linking dynamically with mimalloc, these
+// can be more performant than the standard new-delete operations.
+// See
+// ---------------------------------------------------------------------------
+#if defined(__cplusplus)
+ #include
+ #include
+
+ void operator delete(void* p) noexcept { mi_free(p); };
+ void operator delete[](void* p) noexcept { mi_free(p); };
+
+ void* operator new(std::size_t n) noexcept(false) { return mi_new(n); }
+ void* operator new[](std::size_t n) noexcept(false) { return mi_new(n); }
+
+ void* operator new (std::size_t n, const std::nothrow_t& tag) noexcept { (void)(tag); return mi_new_nothrow(n); }
+ void* operator new[](std::size_t n, const std::nothrow_t& tag) noexcept { (void)(tag); return mi_new_nothrow(n); }
+
+ #if (__cplusplus >= 201402L || _MSC_VER >= 1916)
+ void operator delete (void* p, std::size_t n) { mi_free_size(p,n); };
+ void operator delete[](void* p, std::size_t n) { mi_free_size(p,n); };
+ #endif
+
+ #if (__cplusplus > 201402L || defined(__cpp_aligned_new))
+ void operator delete (void* p, std::align_val_t al) noexcept { mi_free_aligned(p, static_cast(al)); }
+ void operator delete[](void* p, std::align_val_t al) noexcept { mi_free_aligned(p, static_cast(al)); }
+ void operator delete (void* p, std::size_t n, std::align_val_t al) noexcept { mi_free_size_aligned(p, n, static_cast(al)); };
+ void operator delete[](void* p, std::size_t n, std::align_val_t al) noexcept { mi_free_size_aligned(p, n, static_cast(al)); };
+
+ void* operator new( std::size_t n, std::align_val_t al) noexcept(false) { return mi_new_aligned(n, static_cast(al)); }
+ void* operator new[]( std::size_t n, std::align_val_t al) noexcept(false) { return mi_new_aligned(n, static_cast(al)); }
+ void* operator new (std::size_t n, std::align_val_t al, const std::nothrow_t&) noexcept { return mi_new_aligned_nothrow(n, static_cast(al)); }
+ void* operator new[](std::size_t n, std::align_val_t al, const std::nothrow_t&) noexcept { return mi_new_aligned_nothrow(n, static_cast(al)); }
+ #endif
+#endif
+
+#endif // MIMALLOC_NEW_DELETE_H
diff --git a/include/mimalloc-override.h b/include/mimalloc-override.h
index 56b41e6b..201fb8b4 100644
--- a/include/mimalloc-override.h
+++ b/include/mimalloc-override.h
@@ -13,14 +13,9 @@ This header can be used to statically redirect malloc/free and new/delete
to the mimalloc variants. This can be useful if one can include this file on
each source file in a project (but be careful when using external code to
not accidentally mix pointers from different allocators).
-
-On windows it can still be good to always try to include this header even
-when dynamically overriding since this will give better performance especially
-for new/delete. On Unix dynamic overriding already includes all variants so
-including this header is not necessary.
-----------------------------------------------------------------------------*/
-#include "mimalloc.h"
+#include
// Standard C allocation
#define malloc(n) mi_malloc(n)
@@ -68,43 +63,4 @@ including this header is not necessary.
#define _aligned_offset_realloc(p,n,a,o) mi_realloc_aligned_at(p,n,a,o)
#define _aligned_offset_recalloc(p,s,n,a,o) mi_recalloc_aligned_at(p,s,n,a,o)
-
-// -----------------------------------------------------------------
-// With a C++ compiler we can override all the new/delete operators
-// by defining 'MIMALLOC_DEFINE_NEW_DELETE' in some source file and
-// then including this header file. This is not needed when linking
-// statically with the mimalloc library, but it can be more performant
-// on Windows when using dynamic overiding as well.
-// see
-// -----------------------------------------------------------------
-#if defined(__cplusplus) && defined(MIMALLOC_DEFINE_NEW_DELETE)
- #include
-
- void operator delete(void* p) noexcept { mi_free(p); };
- void operator delete[](void* p) noexcept { mi_free(p); };
-
- void* operator new(std::size_t n) noexcept(false) { return mi_new(n); }
- void* operator new[](std::size_t n) noexcept(false) { return mi_new(n); }
-
- void* operator new (std::size_t n, const std::nothrow_t& tag) noexcept { (void)(tag); return mi_new_nothrow(n); }
- void* operator new[](std::size_t n, const std::nothrow_t& tag) noexcept { (void)(tag); return mi_new_nothrow(n); }
-
- #if (__cplusplus >= 201402L || _MSC_VER >= 1916)
- void operator delete (void* p, std::size_t n) { mi_free_size(p,n); };
- void operator delete[](void* p, std::size_t n) { mi_free_size(p,n); };
- #endif
-
- #if (__cplusplus > 201402L || defined(__cpp_aligned_new))
- void operator delete (void* p, std::align_val_t al) noexcept { mi_free_aligned(p, static_cast(al)); }
- void operator delete[](void* p, std::align_val_t al) noexcept { mi_free_aligned(p, static_cast(al)); }
- void operator delete (void* p, std::size_t n, std::align_val_t al) noexcept { mi_free_size_aligned(p, n, static_cast(al)); };
- void operator delete[](void* p, std::size_t n, std::align_val_t al) noexcept { mi_free_size_aligned(p, n, static_cast(al)); };
-
- void* operator new( std::size_t n, std::align_val_t al) noexcept(false) { return mi_new_aligned(n, static_cast(al)); }
- void* operator new[]( std::size_t n, std::align_val_t al) noexcept(false) { return mi_new_aligned(n, static_cast(al)); }
- void* operator new (std::size_t n, std::align_val_t al, const std::nothrow_t&) noexcept { return mi_new_aligned_nothrow(n, static_cast(al)); }
- void* operator new[](std::size_t n, std::align_val_t al, const std::nothrow_t&) noexcept { return mi_new_aligned_nothrow(n, static_cast(al)); }
- #endif
-#endif
-
#endif // MIMALLOC_OVERRIDE_H