diff --git a/contrib/vcpkg/portfile.cmake b/contrib/vcpkg/portfile.cmake index 058ce985..55f0172f 100644 --- a/contrib/vcpkg/portfile.cmake +++ b/contrib/vcpkg/portfile.cmake @@ -5,11 +5,11 @@ vcpkg_from_github( # The "REF" can be a commit hash, branch name (dev2), or a version (v2.2.1). # REF "v${VERSION}" - REF be05b232e8a51e076aae6d8f4a5c3049ce51cb01 + REF 6a89f8554eaab8d8d00e17b5b09f79e1d8dbf61b # The sha512 is the hash of the tar.gz bundle. # (To get the sha512, run `vcpkg install mimalloc[override] --overlay-ports=` and copy the sha from the error message.) - SHA512 24f640db050d6263e557fe9d024e6c0435762118605c0d04801efbcb32e96382b0b995000715fc0c2dcd67c67825a100a6690ecf0ef097b0a3ae107a82d74f7d + SHA512 32b87a3195efcc558b83a546348a8fb544fed335cdd6c9f8e7e9d0e8e64540fdcf1f4aa57fd0e783b78731518f4810292b832227d7e7665bf8426f1e6ce96f9d ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS diff --git a/contrib/vcpkg/vcpkg-cmake-wrapper.cmake b/contrib/vcpkg/vcpkg-cmake-wrapper.cmake index 6b917347..1b355722 100644 --- a/contrib/vcpkg/vcpkg-cmake-wrapper.cmake +++ b/contrib/vcpkg/vcpkg-cmake-wrapper.cmake @@ -17,5 +17,4 @@ endif() if(TARGET mimalloc-static AND NOT TARGET mimalloc) add_library(mimalloc INTERFACE IMPORTED) set_target_properties(mimalloc PROPERTIES INTERFACE_LINK_LIBRARIES mimalloc-static) - set_target_properties(mimalloc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES mimalloc-static) endif() diff --git a/contrib/vcpkg/vcpkg.json b/contrib/vcpkg/vcpkg.json index bdbe9ba1..95d3b15d 100644 --- a/contrib/vcpkg/vcpkg.json +++ b/contrib/vcpkg/vcpkg.json @@ -1,6 +1,6 @@ { "name": "mimalloc", - "version": "1.9.2", + "version": "3.0.2", "port-version": 2, "description": "Compact general purpose allocator with excellent performance", "homepage": "https://github.com/microsoft/mimalloc", diff --git a/ide/vs2022/mimalloc-lib.vcxproj b/ide/vs2022/mimalloc-lib.vcxproj index ad59abe3..b0547769 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 4bac118f..be69716f 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 diff --git a/src/page-map.c b/src/page-map.c index 1cf0b07b..be99814c 100644 --- a/src/page-map.c +++ b/src/page-map.c @@ -296,12 +296,16 @@ void _mi_page_map_register(mi_page_t* page) { void _mi_page_map_unregister(mi_page_t* page) { mi_assert_internal(_mi_page_map != NULL); + mi_assert_internal(page != NULL); + mi_assert_internal(_mi_is_aligned(page, MI_PAGE_ALIGN)); + mi_assert_internal(_mi_page_map != NULL); + if mi_unlikely(_mi_page_map == NULL) return; // get index and count size_t slice_count; size_t sub_idx; const size_t idx = mi_page_map_get_idx(page, &sub_idx, &slice_count); // unset the offsets - mi_page_map_set_range(page, idx, sub_idx, slice_count); + // mi_page_map_set_range(NULL, idx, sub_idx, slice_count); } void _mi_page_map_unregister_range(void* start, size_t size) { @@ -311,9 +315,10 @@ void _mi_page_map_unregister_range(void* start, size_t size) { mi_page_map_set_range(NULL, idx, sub_idx, slice_count); // todo: avoid committing if not already committed? } - +// Return the empty page for the NULL pointer to match the behaviour of `_mi_ptr_page` mi_page_t* _mi_safe_ptr_page(const void* p) { if mi_unlikely(p >= mi_page_map_max_address) return NULL; + if (p == NULL) return (mi_page_t*)&_mi_page_empty; // to match `_mi_ptr_page` (see `mi_free` as well) size_t sub_idx; const size_t idx = _mi_page_map_index(p,&sub_idx); if mi_unlikely(!mi_page_map_is_committed(idx,NULL)) return NULL; @@ -323,7 +328,7 @@ mi_page_t* _mi_safe_ptr_page(const void* p) { } mi_decl_nodiscard mi_decl_export bool mi_is_in_heap_region(const void* p) mi_attr_noexcept { - return (_mi_safe_ptr_page(p) != NULL); + return (p != NULL && _mi_safe_ptr_page(p) != NULL); } #endif