ReactOS 0.4.16-dev-1025-gd3456f5
free.cpp
Go to the documentation of this file.
1//
2// free.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Implementation of free().
7//
8#include <corecrt_internal.h>
9#include <malloc.h>
10
11// Frees a block in the heap. The 'block' pointer must either be a null pointer
12// or must point to a valid block in the heap.
13//
14// This function supports patching and therefore must be marked noinline.
15// Both _free_dbg and _free_base must also be marked noinline
16// to prevent identical COMDAT folding from substituting calls to free
17// with either other function or vice versa.
19{
20 // Some libraries that hook memory allocation routines (such as libtcmalloc)
21 // look for an appropriate place inside free to place a patch to its version
22 // of free. Without these extra instructions padding the call to _free_base,
23 // some libraries may choose to insert this patch in _free_base instead.
24 volatile int extra_instructions_for_patching_libraries = 0;
25 (void) extra_instructions_for_patching_libraries;
26
27 #ifdef _DEBUG
29 #else
31 #endif
32}
#define __cdecl
Definition: accygwin.h:79
_ACRTIMP void __cdecl _free_base(_Pre_maybenull_ _Post_invalid_ void *_Block)
#define _free_dbg(p, t)
Definition: crtdbg.h:209
#define _NORMAL_BLOCK
Definition: crtdbg.h:67
#define free
Definition: debug_ros.c:5
#define noinline
Definition: types.h:64
void __declspec(noinline) __cdecl _free_base(void *const block)
Definition: free_base.cpp:98
#define _CRT_HYBRIDPATCHABLE
Definition: corecrt.h:188
static unsigned int block
Definition: xmlmemory.c:101