ReactOS
0.4.16-dev-1946-g52006dd
malloc.cpp
Go to the documentation of this file.
1
//
2
// malloc.cpp
3
//
4
// Copyright (c) Microsoft Corporation. All rights reserved.
5
//
6
// Implementation of malloc().
7
//
8
#include <
corecrt_internal.h
>
9
#include <malloc.h>
10
11
12
13
// Allocates a block of memory of size 'size' bytes in the heap. If allocation
14
// fails, nullptr is returned.
15
//
16
// This function supports patching and therefore must be marked noinline.
17
// Both _malloc_dbg and _malloc_base must also be marked noinline
18
// to prevent identical COMDAT folding from substituting calls to malloc
19
// with either other function or vice versa.
20
extern
"C"
_CRT_HYBRIDPATCHABLE
__declspec
(
noinline
)
_CRTRESTRICT
void
*
__cdecl
malloc
(
size_t
const
size
)
21
{
22
#ifdef _DEBUG
23
return
_malloc_dbg
(
size
,
_NORMAL_BLOCK
,
nullptr
, 0);
24
#else
25
return
_malloc_base(
size
);
26
#endif
27
}
__cdecl
#define __cdecl
Definition:
accygwin.h:79
corecrt_internal.h
_CRTRESTRICT
#define _CRTRESTRICT
Definition:
corecrt.h:17
_malloc_dbg
#define _malloc_dbg(s, t, f, l)
Definition:
crtdbg.h:204
_NORMAL_BLOCK
#define _NORMAL_BLOCK
Definition:
crtdbg.h:67
malloc
#define malloc
Definition:
debug_ros.c:4
noinline
#define noinline
Definition:
types.h:64
__declspec
void __declspec(noinline) __cdecl _free_base(void *const block)
Definition:
free_base.cpp:98
size
GLsizeiptr size
Definition:
glext.h:5919
_CRT_HYBRIDPATCHABLE
#define _CRT_HYBRIDPATCHABLE
Definition:
corecrt.h:188
sdk
lib
ucrt
heap
malloc.cpp
Generated on Thu Dec 4 2025 06:16:18 for ReactOS by
1.9.6