ReactOS 0.4.16-dev-927-g467dec4
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.
21{
22 #ifdef _DEBUG
23 return _malloc_dbg(size, _NORMAL_BLOCK, nullptr, 0);
24 #else
25 return _malloc_base(size);
26 #endif
27}
#define __cdecl
Definition: accygwin.h:79
#define _CRTRESTRICT
Definition: corecrt.h:17
#define _malloc_dbg(s, t, f, l)
Definition: crtdbg.h:204
#define _NORMAL_BLOCK
Definition: crtdbg.h:67
#define malloc
Definition: debug_ros.c:4
#define noinline
Definition: types.h:64
void __declspec(noinline) __cdecl _free_base(void *const block)
Definition: free_base.cpp:98
GLsizeiptr size
Definition: glext.h:5919
#define _CRT_HYBRIDPATCHABLE
Definition: corecrt.h:188