#include <malloc.h>
#include "msvcrt.h"
#include "mtdll.h"
#include "wine/debug.h"
Go to the source code of this file.
|
| | WINE_DEFAULT_DEBUG_CHANNEL (msvcrt) |
| |
| 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) |
| |
| 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 38 of file heap.c.
◆ LOCK_HEAP
◆ SAVED_PTR
Value: ((
void *)((
DWORD_PTR)((
char *)
x -
sizeof(
void *)) & \
~(sizeof(void *) - 1)))
GLint GLint GLint GLint GLint x
Definition at line 36 of file heap.c.
◆ SB_HEAP_ALIGN
◆ UNLOCK_HEAP
◆ MSVCRT_new_handler_func
◆ __p__amblksiz()
Definition at line 507 of file heap.c.
508{
510}
static unsigned int MSVCRT_amblksiz
◆ _aligned_free()
◆ _aligned_malloc()
Definition at line 603 of file heap.c.
604{
607}
void *CDECL _aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
◆ _aligned_offset_malloc()
Definition at line 560 of file heap.c.
561{
562 void *memblock, *
temp, **saved;
564
565
567 {
570 }
571
572
574 {
577 }
578
579
582
583
585
588
589
591
592
593
596
597 return memblock;
598}
#define ALIGN_PTR(ptr, alignment, offset)
Referenced by _aligned_malloc(), and _aligned_offset_realloc().
◆ _aligned_offset_realloc()
Definition at line 612 of file heap.c.
614{
615 void *
temp, **saved;
616 size_t old_padding, new_padding,
old_size;
618
619 if (!memblock)
621
622
624 {
627 }
628
629
631 {
634 }
635
637 {
640 }
641
642
645
646
649 {
652 }
653
654 old_padding = (char *)memblock - (char *)*saved;
655
656
659 {
660
662 }
663
664
666 {
667
669 }
671
673
676
677
679
680
681
683
684 new_padding = (
char *)memblock - (
char *)
temp;
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716 if (new_padding != old_padding)
718
720
721 return memblock;
722}
void CDECL _aligned_free(void *memblock)
size_t CDECL _msize(void *mem)
#define memmove(s1, s2, n)
Referenced by _aligned_realloc().
◆ _aligned_realloc()
Definition at line 727 of file heap.c.
728{
731}
void *CDECL _aligned_offset_realloc(void *memblock, size_t size, size_t alignment, size_t offset)
◆ _callnewh()
◆ _expand()
Definition at line 236 of file heap.c.
237{
239}
static void * msvcrt_heap_realloc(DWORD flags, void *ptr, size_t size)
#define HEAP_REALLOC_IN_PLACE_ONLY
Referenced by _aligned_offset_realloc_base().
◆ _get_heap_handle()
◆ _get_sbh_threshold()
Definition at line 515 of file heap.c.
516{
518}
static size_t MSVCRT_sbh_threshold
◆ _heapadd()
◆ _heapchk()
Definition at line 244 of file heap.c.
245{
248 {
251 }
253}
BOOL WINAPI HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem)
DWORD WINAPI GetLastError(void)
◆ _heapmin()
Definition at line 258 of file heap.c.
259{
262 {
265 return -1;
266 }
267 return 0;
268}
#define ERROR_CALL_NOT_IMPLEMENTED
SIZE_T WINAPI HeapCompact(HANDLE hHeap, DWORD dwFlags)
◆ _heapset()
Definition at line 317 of file heap.c.
318{
321
325 {
328 }
331}
int CDECL _heapwalk(_HEAPINFO *next)
◆ _heapwalk()
Definition at line 273 of file heap.c.
274{
276
278 FIXME(
"small blocks heap not supported\n");
279
284
287 {
291 }
292
293 do
294 {
296 {
304 }
306
312}
#define ERROR_NO_MORE_ITEMS
BOOL WINAPI HeapWalk(HANDLE hHeap, LPPROCESS_HEAP_ENTRY lpEntry)
#define PROCESS_HEAP_UNCOMMITTED_RANGE
#define PROCESS_HEAP_ENTRY_BUSY
#define PROCESS_HEAP_REGION
static unsigned __int64 next
Referenced by _heapset().
◆ _msize()
◆ _query_new_handler()
◆ _query_new_mode()
◆ _set_new_handler()
◆ _set_new_mode()
◆ _set_sbh_threshold()
Definition at line 523 of file heap.c.
524{
525#ifdef _WIN64
526 return 0;
527#else
528 if(threshold > 1016)
529 return 0;
530
532 {
535 return 0;
536 }
537
539 return 1;
540#endif
541}
HANDLE WINAPI HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
◆ calloc()
Definition at line 386 of file heap.c.
387{
389
391 {
394 }
395
397}
static unsigned char bytes[4]
static void * msvcrt_heap_alloc(DWORD flags, size_t size)
GLuint GLuint GLsizei count
◆ free()
Definition at line 412 of file heap.c.
413{
415}
static BOOL msvcrt_heap_free(void *ptr)
◆ malloc()
Definition at line 430 of file heap.c.
431{
433
434 do
435 {
438 break;
440
444}
int CDECL _callnewh(size_t size)
◆ memcpy_s()
◆ memmove_s()
Definition at line 736 of file heap.c.
737{
739
741 return 0;
742
746
748 return 0;
749}
◆ msvcrt_destroy_heap()
Definition at line 840 of file heap.c.
841{
842#if _MSVCR_VER <= 100 && !defined(__REACTOS__)
844#endif
847}
BOOL WINAPI HeapDestroy(HANDLE hHeap)
Referenced by DllMain().
◆ msvcrt_heap_alloc()
◆ msvcrt_heap_free()
| static BOOL msvcrt_heap_free |
( |
void * |
ptr | ) |
|
|
static |
◆ msvcrt_heap_realloc()
Definition at line 74 of file heap.c.
75{
77 {
78
79 void *memblock, *
temp, **saved;
80 size_t old_padding, new_padding,
old_size;
81
83 old_padding = (
char*)
ptr - (
char*)*saved;
88
91
94 new_padding = (
char*)memblock - (
char*)
temp;
95
96 if(new_padding != old_padding)
98
100 return memblock;
101 }
102
104}
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
Referenced by _expand(), and realloc().
◆ msvcrt_heap_size()
Definition at line 117 of file heap.c.
118{
120 {
123 }
124
126}
Referenced by _msize().
◆ msvcrt_init_heap()
Definition at line 830 of file heap.c.
831{
832#if _MSVCR_VER <= 100 && !defined(__REACTOS__)
834#else
836#endif
838}
Referenced by DllMain().
◆ operator_delete()
◆ operator_new()
Definition at line 143 of file heap.c.
144{
146
147 do
148 {
151 {
154 }
156
158#if _MSVCR_VER >= 80
159 throw_bad_alloc();
160#endif
162}
Referenced by operator_new_dbg().
◆ operator_new_dbg()
Definition at line 168 of file heap.c.
169{
171}
void *CDECL DECLSPEC_HOTPATCH operator_new(size_t size)
◆ realloc()
◆ set_new_handler()
Definition at line 217 of file heap.c.
218{
222}
MSVCRT_new_handler_func CDECL _set_new_handler(MSVCRT_new_handler_func func)
◆ WINE_DEFAULT_DEBUG_CHANNEL()
| WINE_DEFAULT_DEBUG_CHANNEL |
( |
msvcrt |
| ) |
|
◆ heap
◆ MSVCRT_amblksiz
◆ MSVCRT_new_handler
◆ MSVCRT_new_mode
◆ MSVCRT_sbh_threshold
| size_t MSVCRT_sbh_threshold = 0 |
|
static |
◆ sb_heap