26 #pragma pack(push,_CRT_PACKING)
35 #define _HEAP_MAXREQ 0xFFFFFFFFFFFFFFE0
37 #define _HEAP_MAXREQ 0xFFFFFFE0
42 #ifndef _STATIC_ASSERT
43 #define _STATIC_ASSERT(expr) typedef char __static_assert_t[ (expr) ]
48 #define _HEAPEMPTY (-1)
50 #define _HEAPBADBEGIN (-3)
51 #define _HEAPBADNODE (-4)
53 #define _HEAPBADPTR (-6)
57 #ifndef _HEAPINFO_DEFINED
63 #define _HEAPINFO_DEFINED
66 #define _mm_free(a) _aligned_free(a)
67 #define _mm_malloc(a, b) _aligned_malloc(a, b)
71 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
72 #pragma push_macro("calloc")
73 #pragma push_macro("free")
74 #pragma push_macro("malloc")
75 #pragma push_macro("realloc")
76 #pragma push_macro("_recalloc")
77 #pragma push_macro("_aligned_free")
78 #pragma push_macro("_aligned_malloc")
79 #pragma push_macro("_aligned_offset_malloc")
80 #pragma push_macro("_aligned_realloc")
81 #pragma push_macro("_aligned_recalloc")
82 #pragma push_macro("_aligned_offset_realloc")
83 #pragma push_macro("_aligned_offset_recalloc")
84 #pragma push_macro("_aligned_msize")
85 #pragma push_macro("_freea")
92 #undef _aligned_malloc
93 #undef _aligned_offset_malloc
94 #undef _aligned_realloc
95 #undef _aligned_recalloc
96 #undef _aligned_offset_realloc
97 #undef _aligned_offset_recalloc
102 #ifndef _CRT_ALLOCATION_DEFINED
103 #define _CRT_ALLOCATION_DEFINED
125 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
126 #pragma pop_macro("calloc")
127 #pragma pop_macro("free")
128 #pragma pop_macro("malloc")
129 #pragma pop_macro("realloc")
130 #pragma pop_macro("_recalloc")
131 #pragma pop_macro("_aligned_free")
132 #pragma pop_macro("_aligned_malloc")
133 #pragma pop_macro("_aligned_offset_malloc")
134 #pragma pop_macro("_aligned_realloc")
135 #pragma pop_macro("_aligned_recalloc")
136 #pragma pop_macro("_aligned_offset_realloc")
137 #pragma pop_macro("_aligned_offset_recalloc")
138 #pragma pop_macro("_aligned_msize")
139 #pragma pop_macro("_freea")
142 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
146 #define _MAX_WAIT_MALLOC_CRT 60000
151 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
152 #pragma push_macro("_expand")
153 #pragma push_macro("_msize")
161 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
162 #pragma pop_macro("_expand")
163 #pragma pop_macro("_msize")
168 #if defined (_DEBUG) || defined (_CRT_USE_WINAPI_FAMILY_DESKTOP_APP)
173 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
181 #define _ALLOCA_S_THRESHOLD 1024
182 #define _ALLOCA_S_STACK_MARKER 0xCCCC
183 #define _ALLOCA_S_HEAP_MARKER 0xDDDD
185 #if defined (_M_IX86)
186 #define _ALLOCA_S_MARKER_SIZE 8
187 #elif defined (_M_X64)
188 #define _ALLOCA_S_MARKER_SIZE 16
189 #elif defined (_M_ARM)
190 #define _ALLOCA_S_MARKER_SIZE 8
191 #elif !defined (RC_INVOKED)
192 #error Unsupported target platform.
197 #if !defined (__midl) && !defined (RC_INVOKED)
198 #pragma warning(push)
199 #pragma warning(disable:6540)
204 *((
unsigned int*)_Ptr) = _Marker;
205 _Ptr = (
char*)_Ptr + _ALLOCA_S_MARKER_SIZE;
212 return size + _ALLOCA_S_MARKER_SIZE > size;
218 #if !defined(_CRTDBG_MAP_ALLOC)
220 #define _malloca(size) \
221 __pragma(warning(suppress: 6255)) \
222 (_MallocaIsSizeInRange(size) \
223 ? _MarkAllocaS(malloc((size_t)(size) + _ALLOCA_S_MARKER_SIZE), _ALLOCA_S_HEAP_MARKER) \
228 #define _malloca(size) \
229 __pragma(warning(suppress: 6255)) \
230 (_MallocaIsSizeInRange(size) \
231 ? (((((size_t)(size) + _ALLOCA_S_MARKER_SIZE) <= _ALLOCA_S_THRESHOLD) \
232 ? _MarkAllocaS(_alloca((size_t)(size) + _ALLOCA_S_MARKER_SIZE), _ALLOCA_S_STACK_MARKER) \
233 : _MarkAllocaS(malloc((size_t)(size) + _ALLOCA_S_MARKER_SIZE), _ALLOCA_S_HEAP_MARKER))) \
240 #define _FREEA_INLINE
245 #define _FREEA_INLINE
250 #if !defined (__midl) && !defined (RC_INVOKED)
251 #if !(defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC))
257 unsigned int _Marker;
260 _Memory = (
char*)_Memory - _ALLOCA_S_MARKER_SIZE;
261 _Marker = *(
unsigned int *)_Memory;
266 #if defined (_ASSERTE)
269 #pragma warning(suppress: 4548)
270 _ASSERTE((
"Corrupted pointer passed to _freea", 0));
282 #define alloca _alloca
_Check_return_ _Ret_maybenull_ _In_ size_t _In_ size_t _Offset
Definition: malloc.h:113
struct _heapinfo _HEAPINFO
#define _Out_opt_
Definition: sal.h:352
#define _ALLOCA_S_STACK_MARKER
Definition: malloc.h:182
__inline void * _MarkAllocaS(_Out_opt_ __crt_typefix(unsigned int *) void *_Ptr, unsigned int _Marker)
Definition: malloc.h:200
#define _CRTIMP
Definition: crtdefs.h:23
#define _Ret_maybenull_
Definition: sal.h:535
#define _Post_invalid_
Definition: sal.h:701
typedef void(__cdecl *_se_translator_function)(unsigned int
_CRTIMP _CRTNOALIAS void __cdecl free(_Pre_maybenull_ _Post_invalid_ void *_Memory)
_Check_return_ _CRTIMP size_t __cdecl _aligned_msize(_Pre_notnull_ void *_Memory, _In_ size_t _Alignment, _In_ size_t _Offset)
#define _ALLOCA_S_HEAP_MARKER
Definition: malloc.h:183
_Check_return_ _CRTIMP size_t __cdecl _msize(_Pre_notnull_ void *_Memory)
#define _CRT_JIT_INTRINSIC
Definition: crtdefs.h:414
_CRTIMP int __cdecl _resetstkoflw(void)
size_t _size
Definition: malloc.h:60
#define _Pre_maybenull_
Definition: sal.h:687
_In_ _CRT_GUARDOVERFLOW size_t _NewSize
Definition: malloc.h:108
#define _Check_return_
Definition: sal.h:563
__inline int _MallocaIsSizeInRange(size_t size)
Definition: malloc.h:210
#define _ASSERTE(expr)
Definition: crtdbg.h:216
#define _In_
Definition: sal.h:314
_Check_return_ _CRTIMP int __cdecl _heapadd(_In_ void *_Memory, _In_ size_t _Size)
#define _CRTRESTRICT
Definition: crtdefs.h:615
#define __crt_typefix(ctype)
Definition: crtdefs.h:2134
_CRTIMP intptr_t __cdecl _get_heap_handle(void)
_Check_return_ _CRTIMP int __cdecl _heapmin(void)
#define _CRT_GUARDOVERFLOW
Definition: crtdefs.h:248
#define _STATIC_ASSERT(expr)
Definition: malloc.h:43
__pragma(warning(push)) __pragma(warning(disable
Definition: malloc.h:253
int _useflag
Definition: malloc.h:61
#define __CRTDECL
Definition: crtdefs.h:622
_CRTIMP size_t __cdecl _heapused(size_t *_Used, size_t *_Commit)
#define _Ret_notnull_
Definition: sal.h:534
_CRTIMP _CRT_MANAGED_HEAP_DEPRECATE int __cdecl _heapwalk(_Inout_ _HEAPINFO *_EntryInfo)
_In_ _CRT_GUARDOVERFLOW size_t _Count
Definition: malloc.h:110
return(_PAIR_TYPE(_FwdIt)(_First, _First))
#define _CRT_MANAGED_HEAP_DEPRECATE
Definition: crtdefs.h:341
_Check_return_ _CRTIMP int __cdecl _heapchk(void)
#define _Inout_
Definition: sal.h:384
_W64 int intptr_t
Definition: crtdefs.h:512
#define _CRTNOALIAS
Definition: crtdefs.h:611
int * _pentry
Definition: malloc.h:59
_Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_Count *_Size) _CRTIMP _CRT_JIT_INTRINSIC _CRTNOALIAS _CRTRESTRICT void *__cdecl calloc(_In_ _CRT_GUARDOVERFLOW size_t _Count
_CRTIMP _CRTNOALIAS void __cdecl _aligned_free(_Pre_maybenull_ _Post_invalid_ void *_Memory)
_CRTIMP int __cdecl _heapset(_In_ unsigned int _Fill)
#define _Pre_notnull_
Definition: sal.h:686
_Check_return_ _Ret_maybenull_ _In_ _CRT_GUARDOVERFLOW size_t _Size
Definition: malloc.h:104
_CRTIMP unsigned long __cdecl _set_malloc_crt_max_wait(_In_ unsigned long _NewValue)
_Check_return_ _Ret_maybenull_ _In_ size_t _Alignment
Definition: malloc.h:112
_Success_(return!=0) _Check_return_ _Ret_maybenull_ _Post_writable_byte_size_(_NewSize) _CRTIMP _CRTNOALIAS _CRTRESTRICT void *__cdecl realloc(_Pre_maybenull_ _Post_invalid_ void *_Memory
void _Fill(_FwdIt _First, _FwdIt _Last, const _Ty &_Val)
Definition: xutility:2597