Skip to content

Commit b196396

Browse files
authored
Merge pull request #1278 from microsoft/dev-main
update main for v2.3.1
2 parents ef1d67e + 0324be0 commit b196396

32 files changed

Lines changed: 534 additions & 253 deletions

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99
contents: write
1010

1111
env:
12-
RELEASE: Release v3.3.0
12+
RELEASE: Release v3.3.1
1313
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1414

1515
name: Release
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ${{ matrix.os }}
2020
strategy:
2121
matrix:
22-
branch: [v1.9.8,v2.3.0,v3.3.0] # [dev,dev2,dev3]
22+
branch: [v1.9.9,v2.3.1,v3.3.1] # [dev,dev2,dev3]
2323
# we build on the oldest ubuntu version for better binary compatibility.
2424
os: [windows-latest, macOS-latest, macos-15-intel, ubuntu-22.04, ubuntu-22.04-arm]
2525

CMakeLists.txt

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ project(libmimalloc C CXX)
44
set(CMAKE_C_STANDARD 11)
55
set(CMAKE_CXX_STANDARD 17)
66

7-
option(MI_SECURE "Use full security mitigations (like guard pages, allocation randomization, double-free mitigation, and free-list corruption detection)" OFF)
7+
option(MI_SECURE "Use security mitigations (like meta data guard pages, allocation randomization, double-free mitigation, and free-list corruption detection)" OFF)
8+
option(MI_SECURE_FULL "Use full security mitigations including guard pages at the end of each mimalloc page (may be expensive)" OFF)
89
option(MI_PADDING "Enable padding to detect heap block overflow (always on in DEBUG or SECURE mode, or with Valgrind/ASAN)" OFF)
910
option(MI_OVERRIDE "Override the standard malloc interface (i.e. define entry points for 'malloc', 'free', etc)" ON)
1011
option(MI_XMALLOC "Enable abort() call on memory allocation failure by default" OFF)
@@ -45,6 +46,10 @@ option(MI_EXTRA_CPPDEFS "Extra pre-processor definitions (use as `-DMI_EXTRA
4546
option(MI_NO_USE_CXX "Use plain C compilation (has priority over MI_USE_CXX)" OFF)
4647
option(MI_NO_OPT_ARCH "Do not use architecture specific optimizations (like '-march=armv8.1-a' for example) (has priority over MI_OPT_ARCH)" OFF)
4748

49+
# experimental
50+
option(MI_WIN_INIT_USE_RAW_DLLMAIN "Use the raw DLL main entry point for mimalloc initialization; can be more robust but can also lead to link errors with other libraries" OFF)
51+
option(MI_WIN_INIT_USE_TLS_DLLMAIN "Use legacy TLS entries with DllMain for mimalloc initialization" OFF)
52+
4853
# deprecated options
4954
option(MI_WIN_USE_FLS "Use Fiber local storage on Windows to detect thread termination (deprecated)" OFF)
5055
option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode (deprecated, use MI_DEBUG_FULL instead)" OFF)
@@ -102,7 +107,7 @@ endif()
102107
# -----------------------------------------------------------------------------
103108

104109
message(STATUS "")
105-
if (NOT CMAKE_BUILD_TYPE)
110+
if(NOT CMAKE_BUILD_TYPE)
106111
if ("${CMAKE_BINARY_DIR}" MATCHES ".*((D|d)ebug|asan|tsan|ubsan|valgrind)$")
107112
message(STATUS "No build type selected, default to 'Debug'")
108113
set(CMAKE_BUILD_TYPE "Debug")
@@ -112,12 +117,12 @@ if (NOT CMAKE_BUILD_TYPE)
112117
endif()
113118
endif()
114119

115-
if (CMAKE_GENERATOR MATCHES "^Visual Studio.*$")
120+
if(CMAKE_GENERATOR MATCHES "^Visual Studio.*$")
116121
message(STATUS "Note: when building with Visual Studio the build type is specified when building.")
117122
message(STATUS "For example: 'cmake --build . --config=Release")
118123
endif()
119124

120-
if("${CMAKE_BINARY_DIR}" MATCHES ".*(S|s)ecure$")
125+
if(NOT MI_SECURE AND NOT MI_SECURE_FULL AND "${CMAKE_BINARY_DIR}" MATCHES ".*(S|s)ecure$")
121126
message(STATUS "Default to secure build")
122127
set(MI_SECURE "ON")
123128
endif()
@@ -217,8 +222,12 @@ if(WIN32)
217222
endif()
218223
endif()
219224

220-
if(MI_SECURE)
221-
message(STATUS "Set full secure build (MI_SECURE=ON)")
225+
if(MI_SECURE_FULL)
226+
set(MI_SECURE ON)
227+
message(STATUS "Set full secure build (MI_SECURE_FULL=ON)")
228+
list(APPEND mi_defines MI_SECURE=5)
229+
elseif(MI_SECURE)
230+
message(STATUS "Set secure build (MI_SECURE=ON)")
222231
list(APPEND mi_defines MI_SECURE=4)
223232
endif()
224233

@@ -393,16 +402,26 @@ if(MI_LIBC_MUSL)
393402
list(APPEND mi_defines MI_LIBC_MUSL=1)
394403
endif()
395404

396-
if(MI_WIN_USE_FLS)
397-
message(STATUS "Use the Fiber API to detect thread termination (deprecated) (MI_WIN_USE_FLS=ON)")
398-
list(APPEND mi_defines MI_WIN_USE_FLS=1)
399-
endif()
400-
401405
if(MI_WIN_USE_FIXED_TLS)
402406
message(STATUS "Use fixed TLS slot on Windows to avoid extra tests in the malloc fast path (MI_WIN_USE_FIXED_TLS=ON)")
403407
list(APPEND mi_defines MI_WIN_USE_FIXED_TLS=1)
404408
endif()
405409

410+
if(MI_WIN_INIT_USE_RAW_DLLMAIN)
411+
message(STATUS "Use raw Dll main entry on Windows to initialize and finalize mimalloc (MI_WIN_INIT_USE_RAW_DLLMAIN=ON)")
412+
message(STATUS "Note: this can lead to link errors if other libraries also try to define a raw Dll main entry point")
413+
list(APPEND mi_defines MI_WIN_INIT_USE_RAW_DLLMAIN=1)
414+
elseif(MI_WIN_INIT_USE_TLS_DLLMAIN)
415+
message(STATUS "Use Dll main entry with TLS entries on Windows to initialize and finalize mimalloc (MI_WIN_INIT_USE_TLS_DLLMAIN=ON)")
416+
list(APPEND mi_defines MI_WIN_INIT_USE_TLS_DLLMAIN=1)
417+
elseif(MI_WIN_USE_FLS)
418+
message(STATUS "Deprecated: Use the Fiber API to detect thread termination (deprecated) (MI_WIN_USE_FLS=ON)")
419+
list(APPEND mi_defines MI_WIN_INIT_USE_FLS=1)
420+
else()
421+
# default uses CRT with TLS entries for initialization and finalization
422+
# list(APPEND mi_defines MI_WIN_INIT_USE_CRT_TLS=1)
423+
endif()
424+
406425
# Check /proc/cpuinfo for an SV39 MMU and limit the virtual address bits.
407426
# (this will skip the aligned hinting in that case. Issue #939, #949)
408427
if (EXISTS /proc/cpuinfo)

cmake/mimalloc-config-version.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(mi_version_major 2)
22
set(mi_version_minor 3)
3-
set(mi_version_patch 0)
3+
set(mi_version_patch 1)
44
set(mi_version ${mi_version_major}.${mi_version_minor})
55

66
set(PACKAGE_VERSION ${mi_version})

contrib/vcpkg/portfile.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ vcpkg_from_github(
33
REPO microsoft/mimalloc
44
HEAD_REF master
55

6-
# The "REF" can be a commit hash, branch name (dev3), or a version (v3.3.0).
6+
# The "REF" can be a commit hash, branch name (dev3), or a version (v3.3.1).
77
REF "v${VERSION}"
88
# REF e2db21e9ba9fb9172b7b0aa0fe9b8742525e8774
99

1010
# The sha512 is the hash of the tar.gz bundle.
1111
# (To get the sha512, run `vcpkg install "mimalloc[override]" --overlay-ports=<dir of this file>` and copy the sha from the error message.)
12-
SHA512 5830ceb1bf0d02f50fe586caaad87624ba8eba1bb66e68e8201894221cf6f51854f5a9667fc98358c3b430dae6f9bf529bfcb74d42debe6f40a487265053371c
12+
# (and maybe `vcpkg remove mimalloc` first to remove any previous install)
13+
SHA512 601bdf622d0bc7521edf0cc73d1caec9d976bcd1faa689ff48cc18a9a6a3b2294b571fc71d3266b38907bc5aad10a41d92d03d2cdde139a30b08357ee7bc25c5
1314
)
1415

1516
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS

ide/vs2022/mimalloc-override-static-lib.vcxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
<CompileAs>CompileAsCpp</CompileAs>
179179
<SupportJustMyCode>false</SupportJustMyCode>
180180
<LanguageStandard>stdcpp20</LanguageStandard>
181-
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
181+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
182182
</ClCompile>
183183
<Lib>
184184
<AdditionalLibraryDirectories>
@@ -226,7 +226,7 @@
226226
<CompileAs>CompileAsCpp</CompileAs>
227227
<SupportJustMyCode>false</SupportJustMyCode>
228228
<LanguageStandard>stdcpp20</LanguageStandard>
229-
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
229+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
230230
</ClCompile>
231231
<PostBuildEvent>
232232
<Command>
@@ -254,7 +254,7 @@
254254
<CompileAs>CompileAsCpp</CompileAs>
255255
<SupportJustMyCode>false</SupportJustMyCode>
256256
<LanguageStandard>stdcpp20</LanguageStandard>
257-
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
257+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
258258
</ClCompile>
259259
<PostBuildEvent>
260260
<Command>

ide/vs2022/mimalloc-test-override-static.vcxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
<ConformanceMode>true</ConformanceMode>
160160
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
161161
<LanguageStandard>stdcpp17</LanguageStandard>
162-
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
162+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
163163
<PreprocessorDefinitions>MI_DEBUG=3;;MI_MALLOC_OVERRIDE</PreprocessorDefinitions>
164164
</ClCompile>
165165
<Link>
@@ -189,7 +189,7 @@
189189
<ConformanceMode>true</ConformanceMode>
190190
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
191191
<LanguageStandard>stdcpp17</LanguageStandard>
192-
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
192+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
193193
<PreprocessorDefinitions>MI_DEBUG=3;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions);MI_MALLOC_OVERRIDE</PreprocessorDefinitions>
194194
</ClCompile>
195195
<Link>
@@ -204,7 +204,7 @@
204204
<ConformanceMode>true</ConformanceMode>
205205
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
206206
<LanguageStandard>stdcpp17</LanguageStandard>
207-
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
207+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
208208
<PreprocessorDefinitions>MI_DEBUG=3;_AMD64_;_ARM64EC_;%(ClCompile.PreprocessorDefinitions);MI_MALLOC_OVERRIDE</PreprocessorDefinitions>
209209
</ClCompile>
210210
<Link>

ide/vs2022/mimalloc.sln

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ EndProject
1414
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mimalloc-test-override-dep", "mimalloc-override-test-dep.vcxproj", "{FEF7869F-750E-4C21-A04D-22707CC66879}"
1515
EndProject
1616
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mimalloc-test-static", "mimalloc-test.vcxproj", "{FEF7858F-750E-4C21-A04D-22707CC66878}"
17+
ProjectSection(ProjectDependencies) = postProject
18+
{FEF78690-750E-4C21-A04D-22707CC66879} = {FEF78690-750E-4C21-A04D-22707CC66879}
19+
EndProjectSection
1720
EndProject
1821
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mimalloc-test-static-dep", "mimalloc-test-dep.vcxproj", "{FEF78690-750E-4C21-A04D-22707CC66879}"
1922
EndProject

include/mimalloc-override.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ not accidentally mix pointers from different allocators).
1919

2020
// Standard C allocation
2121
#define malloc(n) mi_malloc(n)
22-
#define calloc(n,c) mi_calloc(n,c)
22+
#define calloc(c,n) mi_calloc(c,n)
2323
#define realloc(p,n) mi_realloc(p,n)
2424
#define free(p) mi_free(p)
2525

@@ -30,26 +30,26 @@ not accidentally mix pointers from different allocators).
3030
// Microsoft extensions
3131
#define _expand(p,n) mi_expand(p,n)
3232
#define _msize(p) mi_usable_size(p)
33-
#define _recalloc(p,n,c) mi_recalloc(p,n,c)
33+
#define _recalloc(p,c,n) mi_recalloc(p,c,n)
3434

3535
#define _strdup(s) mi_strdup(s)
3636
#define _strndup(s,n) mi_strndup(s,n)
37-
#define _wcsdup(s) (wchar_t*)mi_wcsdup((const unsigned short*)(s))
37+
#define _wcsdup(s) mi_wcsdup(s)
3838
#define _mbsdup(s) mi_mbsdup(s)
39-
#define _dupenv_s(b,n,v) mi_dupenv_s(b,n,v)
40-
#define _wdupenv_s(b,n,v) mi_wdupenv_s((unsigned short*)(b),n,(const unsigned short*)(v))
39+
#define _dupenv_s(buf,n,nm) mi_dupenv_s(buf,n,nm)
40+
#define _wdupenv_s(buf,n,nm) mi_wdupenv_s(buf,n,nm)
4141

4242
// Various Posix and Unix variants
4343
#define reallocf(p,n) mi_reallocf(p,n)
4444
#define malloc_size(p) mi_usable_size(p)
4545
#define malloc_usable_size(p) mi_usable_size(p)
46-
#define malloc_good_size(sz) mi_malloc_good_size(sz)
46+
#define malloc_good_size(n) mi_malloc_good_size(n)
4747
#define cfree(p) mi_free(p)
4848

4949
#define valloc(n) mi_valloc(n)
5050
#define pvalloc(n) mi_pvalloc(n)
51-
#define reallocarray(p,s,n) mi_reallocarray(p,s,n)
52-
#define reallocarr(p,s,n) mi_reallocarr(p,s,n)
51+
#define reallocarray(p,c,n) mi_reallocarray(p,c,n)
52+
#define reallocarr(ptrp,c,n) mi_reallocarr(ptrp,c,n)
5353
#define memalign(a,n) mi_memalign(a,n)
5454
#define aligned_alloc(a,n) mi_aligned_alloc(a,n)
5555
#define posix_memalign(p,a,n) mi_posix_memalign(p,a,n)
@@ -58,11 +58,11 @@ not accidentally mix pointers from different allocators).
5858
// Microsoft aligned variants
5959
#define _aligned_malloc(n,a) mi_malloc_aligned(n,a)
6060
#define _aligned_realloc(p,n,a) mi_realloc_aligned(p,n,a)
61-
#define _aligned_recalloc(p,s,n,a) mi_aligned_recalloc(p,s,n,a)
61+
#define _aligned_recalloc(p,c,n,a) mi_aligned_recalloc(p,c,n,a)
6262
#define _aligned_msize(p,a,o) mi_usable_size(p)
6363
#define _aligned_free(p) mi_free(p)
6464
#define _aligned_offset_malloc(n,a,o) mi_malloc_aligned_at(n,a,o)
6565
#define _aligned_offset_realloc(p,n,a,o) mi_realloc_aligned_at(p,n,a,o)
66-
#define _aligned_offset_recalloc(p,s,n,a,o) mi_recalloc_aligned_at(p,s,n,a,o)
66+
#define _aligned_offset_recalloc(p,c,n,a,o) mi_recalloc_aligned_at(p,c,n,a,o)
6767

6868
#endif // MIMALLOC_OVERRIDE_H

include/mimalloc-stats.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ typedef struct mi_stat_counter_s {
3232
MI_STAT_COUNTER(reset) /* reset bytes */ \
3333
MI_STAT_COUNTER(purged) /* purged bytes */ \
3434
MI_STAT_COUNT(page_committed) /* committed memory inside pages */ \
35-
MI_STAT_COUNT(pages_abandoned) /* abandonded pages count */ \
35+
MI_STAT_COUNT(pages_abandoned) /* abandoned pages count */ \
3636
MI_STAT_COUNT(threads) /* number of threads */ \
3737
MI_STAT_COUNT(malloc_normal) /* allocated bytes <= MI_LARGE_OBJ_SIZE_MAX */ \
3838
MI_STAT_COUNT(malloc_huge) /* allocated bytes in huge pages */ \

include/mimalloc.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ terms of the MIT license. A copy of the license can be found in the file
88
#ifndef MIMALLOC_H
99
#define MIMALLOC_H
1010

11-
#define MI_MALLOC_VERSION 20300 // major + 2 digits minor + 2 digits patch
11+
#define MI_MALLOC_VERSION 20301 // major + 2 digits minor + 2 digits patch
1212

1313
// ------------------------------------------------------
1414
// Compiler specific attributes
@@ -115,7 +115,7 @@ mi_decl_export void* mi_expand(void* p, size_t newsize)
115115
mi_decl_export void mi_free(void* p) mi_attr_noexcept;
116116
mi_decl_nodiscard mi_decl_export mi_decl_restrict char* mi_strdup(const char* s) mi_attr_noexcept mi_attr_malloc;
117117
mi_decl_nodiscard mi_decl_export mi_decl_restrict char* mi_strndup(const char* s, size_t n) mi_attr_noexcept mi_attr_malloc;
118-
mi_decl_nodiscard mi_decl_export mi_decl_restrict char* mi_realpath(const char* fname, char* resolved_name) mi_attr_noexcept mi_attr_malloc;
118+
mi_decl_nodiscard mi_decl_export mi_decl_restrict char* mi_realpath(const char* fname, char* resolved_name) mi_attr_noexcept;
119119

120120
// ------------------------------------------------------
121121
// Extended functionality
@@ -231,7 +231,7 @@ mi_decl_nodiscard mi_decl_export void* mi_heap_reallocf(mi_heap_t* heap, void* p
231231

232232
mi_decl_nodiscard mi_decl_export mi_decl_restrict char* mi_heap_strdup(mi_heap_t* heap, const char* s) mi_attr_noexcept mi_attr_malloc;
233233
mi_decl_nodiscard mi_decl_export mi_decl_restrict char* mi_heap_strndup(mi_heap_t* heap, const char* s, size_t n) mi_attr_noexcept mi_attr_malloc;
234-
mi_decl_nodiscard mi_decl_export mi_decl_restrict char* mi_heap_realpath(mi_heap_t* heap, const char* fname, char* resolved_name) mi_attr_noexcept mi_attr_malloc;
234+
mi_decl_nodiscard mi_decl_export mi_decl_restrict char* mi_heap_realpath(mi_heap_t* heap, const char* fname, char* resolved_name) mi_attr_noexcept;
235235

236236
mi_decl_nodiscard mi_decl_export mi_decl_restrict void* mi_heap_malloc_aligned(mi_heap_t* heap, size_t size, size_t alignment) mi_attr_noexcept mi_attr_malloc mi_attr_alloc_size(2) mi_attr_alloc_align(3);
237237
mi_decl_nodiscard mi_decl_export mi_decl_restrict void* mi_heap_malloc_aligned_at(mi_heap_t* heap, size_t size, size_t alignment, size_t offset) mi_attr_noexcept mi_attr_malloc mi_attr_alloc_size(2);
@@ -474,18 +474,20 @@ mi_decl_nodiscard mi_decl_export mi_decl_restrict void* mi_pvalloc(size_t size)
474474
mi_decl_nodiscard mi_decl_export mi_decl_restrict void* mi_aligned_alloc(size_t alignment, size_t size) mi_attr_noexcept mi_attr_malloc mi_attr_alloc_size(2) mi_attr_alloc_align(1);
475475

476476
mi_decl_nodiscard mi_decl_export void* mi_reallocarray(void* p, size_t count, size_t size) mi_attr_noexcept mi_attr_alloc_size2(2,3);
477-
mi_decl_nodiscard mi_decl_export int mi_reallocarr(void* p, size_t count, size_t size) mi_attr_noexcept;
477+
mi_decl_nodiscard mi_decl_export int mi_reallocarr(void* ptrp, size_t count, size_t size) mi_attr_noexcept;
478478
mi_decl_nodiscard mi_decl_export void* mi_aligned_recalloc(void* p, size_t newcount, size_t size, size_t alignment) mi_attr_noexcept;
479479
mi_decl_nodiscard mi_decl_export void* mi_aligned_offset_recalloc(void* p, size_t newcount, size_t size, size_t alignment, size_t offset) mi_attr_noexcept;
480480

481-
mi_decl_nodiscard mi_decl_export mi_decl_restrict unsigned short* mi_wcsdup(const unsigned short* s) mi_attr_noexcept mi_attr_malloc;
482-
mi_decl_nodiscard mi_decl_export mi_decl_restrict unsigned char* mi_mbsdup(const unsigned char* s) mi_attr_noexcept mi_attr_malloc;
483-
mi_decl_export int mi_dupenv_s(char** buf, size_t* size, const char* name) mi_attr_noexcept;
484-
mi_decl_export int mi_wdupenv_s(unsigned short** buf, size_t* size, const unsigned short* name) mi_attr_noexcept;
485-
486481
mi_decl_export void mi_free_size(void* p, size_t size) mi_attr_noexcept;
487482
mi_decl_export void mi_free_size_aligned(void* p, size_t size, size_t alignment) mi_attr_noexcept;
488483
mi_decl_export void mi_free_aligned(void* p, size_t alignment) mi_attr_noexcept;
484+
mi_decl_export int mi_dupenv_s(char** buf, size_t* size, const char* name) mi_attr_noexcept;
485+
486+
// wide characters
487+
#include <wchar.h> // wchar_t
488+
mi_decl_export int mi_wdupenv_s(wchar_t** buf, size_t* size, const wchar_t* name) mi_attr_noexcept;
489+
mi_decl_nodiscard mi_decl_export mi_decl_restrict wchar_t* mi_wcsdup(const wchar_t* s) mi_attr_noexcept mi_attr_malloc;
490+
mi_decl_nodiscard mi_decl_export mi_decl_restrict unsigned char* mi_mbsdup(const unsigned char* s) mi_attr_noexcept mi_attr_malloc;
489491

490492
// The `mi_new` wrappers implement C++ semantics on out-of-memory instead of directly returning `NULL`.
491493
// (and call `std::get_new_handler` and potentially raise a `std::bad_alloc` exception).

0 commit comments

Comments
 (0)