#include <precomp.h>
#include <malloc.h>
Go to the source code of this file.
|
static void * | msvcrt_heap_alloc (DWORD flags, size_t size) |
|
static void * | msvcrt_heap_realloc (DWORD flags, void *ptr, size_t size) |
|
static BOOL | msvcrt_heap_free (void *ptr) |
|
static size_t | msvcrt_heap_size (void *ptr) |
|
int CDECL | _callnewh (size_t size) |
|
void *CDECL DECLSPEC_HOTPATCH | operator_new (size_t size) |
|
void *CDECL | operator_new_dbg (size_t size, int type, const char *file, int line) |
|
void CDECL DECLSPEC_HOTPATCH | operator_delete (void *mem) |
|
MSVCRT_new_handler_func CDECL | _query_new_handler (void) |
|
int CDECL | _query_new_mode (void) |
|
MSVCRT_new_handler_func CDECL | _set_new_handler (MSVCRT_new_handler_func func) |
|
MSVCRT_new_handler_func CDECL | set_new_handler (void *func) |
|
int CDECL | _set_new_mode (int mode) |
|
void *CDECL | _expand (void *mem, size_t size) |
|
int CDECL | _heapchk (void) |
|
int CDECL | _heapmin (void) |
|
int CDECL | _heapwalk (_HEAPINFO *next) |
|
int CDECL | _heapset (unsigned int value) |
|
int CDECL | _heapadd (void *mem, size_t size) |
|
intptr_t CDECL | _get_heap_handle (void) |
|
size_t CDECL | _msize (void *mem) |
|
void *CDECL DECLSPEC_HOTPATCH | calloc (size_t count, size_t size) |
|
void CDECL DECLSPEC_HOTPATCH | free (void *ptr) |
|
void *CDECL | malloc (size_t size) |
|
void *CDECL DECLSPEC_HOTPATCH | realloc (void *ptr, size_t size) |
|
unsigned int *CDECL | __p__amblksiz (void) |
|
size_t CDECL | _get_sbh_threshold (void) |
|
int CDECL | _set_sbh_threshold (size_t threshold) |
|
void CDECL | _aligned_free (void *memblock) |
|
void *CDECL | _aligned_offset_malloc (size_t size, size_t alignment, size_t offset) |
|
void *CDECL | _aligned_malloc (size_t size, size_t alignment) |
|
void *CDECL | _aligned_offset_realloc (void *memblock, size_t size, size_t alignment, size_t offset) |
|
void *CDECL | _aligned_realloc (void *memblock, size_t size, size_t alignment) |
|
int CDECL | memmove_s (void *dest, size_t numberOfElements, const void *src, size_t count) |
|
int CDECL | memcpy_s (void *dest, size_t numberOfElements, const void *src, size_t count) |
|
int CDECL | strncpy_s (char *dest, size_t numberOfElements, const char *src, size_t count) |
|
BOOL | msvcrt_init_heap (void) |
|
void | msvcrt_destroy_heap (void) |
|
◆ ALIGN_PTR
Value: ((void *) \
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
Definition at line 59 of file heap.c.
◆ LOCK_HEAP
◆ MSVCRT__errno
◆ MSVCRT__FREEENTRY
◆ MSVCRT__HEAPBADBEGIN
◆ MSVCRT__HEAPBADNODE
◆ MSVCRT__HEAPEND
◆ MSVCRT__heapinfo
◆ MSVCRT__HEAPOK
◆ MSVCRT__TRUNCATE
◆ MSVCRT__USEDENTRY
◆ MSVCRT_calloc
◆ MSVCRT_EINVAL
◆ MSVCRT_ENOMEM
◆ MSVCRT_ENOSYS
◆ MSVCRT_ERANGE
◆ MSVCRT_free
◆ MSVCRT_intptr_t
◆ MSVCRT_malloc
◆ MSVCRT_memcpy_s
◆ MSVCRT_memmove_s
◆ MSVCRT_realloc
◆ msvcrt_set_errno
◆ MSVCRT_size_t
◆ MSVCRT_strncpy_s
◆ MSVCRT_wchar_t
◆ SAVED_PTR
Value: ((
void *)((
DWORD_PTR)((
char *)
x -
sizeof(
void *)) & \
~(sizeof(void *) - 1)))
GLint GLint GLint GLint GLint x
Definition at line 57 of file heap.c.
◆ SB_HEAP_ALIGN
◆ UNLOCK_HEAP
◆ MSVCRT_new_handler_func
◆ __p__amblksiz()
Definition at line 528 of file heap.c.
529{
531}
static unsigned int MSVCRT_amblksiz
◆ _aligned_free()
◆ _aligned_malloc()
Definition at line 624 of file heap.c.
625{
628}
void *CDECL _aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
◆ _aligned_offset_malloc()
Definition at line 581 of file heap.c.
582{
583 void *memblock, *
temp, **saved;
585
586
588 {
591 }
592
593
595 {
598 }
599
600
603
604
606
609
610
612
613
614
617
618 return memblock;
619}
_CRTIMP int *__cdecl _errno(void)
#define ALIGN_PTR(ptr, alignment, offset)
Referenced by _aligned_malloc(), and _aligned_offset_realloc().
◆ _aligned_offset_realloc()
Definition at line 633 of file heap.c.
635{
636 void *
temp, **saved;
637 size_t old_padding, new_padding,
old_size;
639
640 if (!memblock)
642
643
645 {
648 }
649
650
652 {
655 }
656
658 {
661 }
662
663
666
667
670 {
673 }
674
675 old_padding = (char *)memblock - (char *)*saved;
676
677
680 {
681
683 }
684
685
687 {
688
690 }
692
694
697
698
700
701
702
704
705 new_padding = (
char *)memblock - (
char *)
temp;
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737 if (new_padding != old_padding)
739
741
742 return memblock;
743}
#define memmove(s1, s2, n)
void CDECL _aligned_free(void *memblock)
size_t CDECL _msize(void *mem)
Referenced by _aligned_realloc().
◆ _aligned_realloc()
Definition at line 748 of file heap.c.
749{
752}
void *CDECL _aligned_offset_realloc(void *memblock, size_t size, size_t alignment, size_t offset)
◆ _callnewh()
Definition at line 152 of file heap.c.
153{
157 ret = (*handler)(
size) ? 1 : 0;
159}
UINT(* handler)(MSIPACKAGE *)
int(CDECL * MSVCRT_new_handler_func)(size_t size)
static MSVCRT_new_handler_func MSVCRT_new_handler
Referenced by malloc(), and operator_new().
◆ _expand()
Definition at line 257 of file heap.c.
258{
260}
#define HEAP_REALLOC_IN_PLACE_ONLY
static void * msvcrt_heap_realloc(DWORD flags, void *ptr, size_t size)
◆ _get_heap_handle()
◆ _get_sbh_threshold()
Definition at line 536 of file heap.c.
537{
539}
static size_t MSVCRT_sbh_threshold
◆ _heapadd()
◆ _heapchk()
Definition at line 265 of file heap.c.
266{
269 {
272 }
274}
BOOL WINAPI HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem)
DWORD WINAPI GetLastError(void)
◆ _heapmin()
Definition at line 279 of file heap.c.
280{
283 {
286 return -1;
287 }
288 return 0;
289}
#define ERROR_CALL_NOT_IMPLEMENTED
SIZE_T WINAPI HeapCompact(HANDLE hHeap, DWORD dwFlags)
◆ _heapset()
Definition at line 338 of file heap.c.
339{
342
346 {
349 }
352}
int CDECL _heapwalk(_HEAPINFO *next)
◆ _heapwalk()
Definition at line 294 of file heap.c.
295{
297
299 FIXME(
"small blocks heap not supported\n");
300
305
308 {
312 }
313
314 do
315 {
317 {
325 }
327
333}
#define ERROR_NO_MORE_ITEMS
BOOL WINAPI HeapWalk(HANDLE hHeap, LPPROCESS_HEAP_ENTRY lpEntry)
static unsigned __int64 next
#define PROCESS_HEAP_UNCOMMITTED_RANGE
#define PROCESS_HEAP_ENTRY_BUSY
#define PROCESS_HEAP_REGION
Referenced by _heapset().
◆ _msize()
Definition at line 375 of file heap.c.
376{
378 if (
size == ~(
size_t)0)
379 {
380 WARN(
":Probably called with non wine-allocated memory, ret = -1\n");
381
382 }
384}
static size_t msvcrt_heap_size(void *ptr)
Referenced by _aligned_offset_realloc().
◆ _query_new_handler()
◆ _query_new_mode()
Definition at line 217 of file heap.c.
218{
220}
static int MSVCRT_new_mode
◆ _set_new_handler()
◆ _set_new_mode()
Definition at line 248 of file heap.c.
249{
252}
#define InterlockedExchange
#define MSVCRT_CHECK_PMT(x)
◆ _set_sbh_threshold()
Definition at line 544 of file heap.c.
545{
546#ifdef _WIN64
547 return 0;
548#else
549 if(threshold > 1016)
550 return 0;
551
553 {
556 return 0;
557 }
558
560 return 1;
561#endif
562}
HANDLE WINAPI HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
◆ calloc()
Definition at line 407 of file heap.c.
408{
410
412 {
415 }
416
418}
static unsigned char bytes[4]
GLuint GLuint GLsizei count
static void * msvcrt_heap_alloc(DWORD flags, size_t size)
◆ free()
Definition at line 433 of file heap.c.
434{
436}
static BOOL msvcrt_heap_free(void *ptr)
◆ malloc()
Definition at line 451 of file heap.c.
452{
454
455 do
456 {
459 break;
461
465}
int CDECL _callnewh(size_t size)
◆ memcpy_s()
◆ memmove_s()
Definition at line 757 of file heap.c.
758{
760
762 return 0;
763
767
769 return 0;
770}
◆ msvcrt_destroy_heap()
Definition at line 899 of file heap.c.
900{
904}
BOOL WINAPI HeapDestroy(HANDLE hHeap)
◆ msvcrt_heap_alloc()
◆ msvcrt_heap_free()
static BOOL msvcrt_heap_free |
( |
void * |
ptr | ) |
|
|
static |
◆ msvcrt_heap_realloc()
Definition at line 95 of file heap.c.
96{
98 {
99
100 void *memblock, *
temp, **saved;
101 size_t old_padding, new_padding,
old_size;
102
104 old_padding = (
char*)
ptr - (
char*)*saved;
109
112
115 new_padding = (
char*)memblock - (
char*)
temp;
116
117 if(new_padding != old_padding)
119
121 return memblock;
122 }
123
125}
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
Referenced by _expand(), and realloc().
◆ msvcrt_heap_size()
Definition at line 138 of file heap.c.
139{
141 {
144 }
145
147}
Referenced by _msize().
◆ msvcrt_init_heap()
◆ operator_delete()
◆ operator_new()
Definition at line 164 of file heap.c.
165{
167
168 do
169 {
172 {
175 }
177
179#if _MSVCR_VER >= 80
180 throw_bad_alloc();
181#endif
183}
Referenced by operator_new_dbg().
◆ operator_new_dbg()
Definition at line 189 of file heap.c.
190{
192}
void *CDECL DECLSPEC_HOTPATCH operator_new(size_t size)
◆ realloc()
◆ set_new_handler()
Definition at line 238 of file heap.c.
239{
243}
MSVCRT_new_handler_func CDECL _set_new_handler(MSVCRT_new_handler_func func)
◆ strncpy_s()
Definition at line 854 of file heap.c.
856{
858
860
864 return 0;
865 }
866
870
873 else
875
878
881 return 0;
882 }
883
887}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define MSVCRT_INVALID_PMT(x)
◆ heap
Definition at line 65 of file heap.c.
Referenced by _get_heap_handle(), _heapchk(), _heapmin(), _heapset(), _heapwalk(), add_dynamic_var(), alloc_bstr(), AllocateAndGetIfTableFromStack(), AllocateAndGetIpAddrTableFromStack(), AllocateAndGetIpForwardTableFromStack(), AllocateAndGetIpNetTableFromStack(), AllocateAndGetTcpExTable2FromStack(), AllocateAndGetTcpExTableFromStack(), AllocateAndGetTcpTableFromStack(), AllocateAndGetUdpExTable2FromStack(), AllocateAndGetUdpExTableFromStack(), AllocateAndGetUdpTableFromStack(), CloseDevice(), constant_heap_free(), constant_heap_init(), CreateSession(), DestroySession(), DrvGetDirectDrawInfo(), heap_pool_alloc(), heap_pool_clear(), heap_pool_free(), heap_pool_grow(), heap_pool_init(), heap_pool_mark(), HEAP_strdupAtoW(), main(), msvcrt_destroy_heap(), msvcrt_heap_alloc(), msvcrt_heap_free(), msvcrt_heap_realloc(), msvcrt_heap_size(), msvcrt_init_heap(), NBCmdQueueCreate(), NBNameCacheCreate(), OpenDevice(), PlayNote(), RunTraceRoute(), shader_glsl_load_constants_f(), shader_glsl_update_float_pixel_constants(), shader_glsl_update_float_vertex_constants(), StopNote(), SysFreeString(), test_child_heap(), test_HeapCreate(), update_heap_entry(), walk_constant_heap(), and walk_constant_heap_clamped().
◆ MSVCRT_amblksiz
◆ MSVCRT_new_handler
◆ MSVCRT_new_mode
◆ MSVCRT_sbh_threshold
size_t MSVCRT_sbh_threshold = 0 |
|
static |
◆ sb_heap