-
Notifications
You must be signed in to change notification settings - Fork 1
/
mconfig.h
executable file
·141 lines (115 loc) · 3.64 KB
/
mconfig.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
* mmalloc - dynamic memory checker
*
* Copyright (C) 2002 Mika Kuoppala <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*/
#ifndef __MCONFIG_H__
#define __MCONFIG_H__
/*
* In Every memory management call PERIOD_CHECK_EVERYTHING value is
* checked and if this is PERIOD_CHECK_EVERYTHING:th call,
* then ALL memory regions and ALL blocks withing them are
* checked for errors
*/
#define PERIOD_CHECK_EVERYTHING 1000
/*
* In Every memory management call PERIOD_CHECK_NEAREST_BLOCKS value is
* checked and if this PERIOD_CHECK_NEAREST_BLOCKS:th call, then the
* current memory memory region and all blocks within it are checked for
* errors
*/
#define PERIOD_CHECK_NEAREST_BLOCKS 10
/*
* Works as the CHECK_* values above and prints statistics of
* memory management in every PERIOD_PRINT_STATISTICS:th call
* Value of 0 means that STATISTICS is disabled.
*/
#define PERIOD_PRINT_STATISTICS 1000000
/*
* Enabling this will give information about each region
* when statistics are printed
*
*/
/* #define PRINT_REGION_STATISTICS */
/*
* If memory management error is found, should be stop or continue
* This is the number of errors before stopping
*/
#define STOP_ON_ERROR 1
/*
* How many megs to allocate for pool
* MMALLOC_MEMSIZE environment variable can also be used, which is in
* kilobytes
*/
#define KILOBYTE 1024ull
#define MEGABYTE (1024ull * KILOBYTE)
#define GIGABYTE (1024ull * MEGABYTE)
#define MMALLOC_MEMSIZE (1 * GIGABYTE)
/*
This is the count of blocks one region contains.
Don't know why but 27 seems to be magically fast on my tests
Tho ofcourse it depends on application
*/
#define BLOCKS_IN_REGION 16
/*
* If DUMP_BLOCK_DATA is defined, raw memory dump of the erroneous block will
* be printed
*/
#define DUMP_BLOCK_DATA
/*
* Length of tailguards (bytes)
*/
#define TAILGUARD_BYTES 8
#define TAILGUARD_DATA (uint8_t)(0xBF)
/*
* If CHECK_FREED_BLOCK_DATA is defined, then when block is freed
* it is filled with FREED_DATA_MAGIC pattern and this is used
* to see if freed blocks has been used when region checks are made
*/
#define CHECK_FREED_BLOCK_DATA
/*
* Magic to fill freed blocks
*/
#ifdef CHECK_FREED_BLOCK_DATA
#define FREED_DATA_MAGIC (unsigned char)(0xFD)
#endif
/*
* If BACKTRACE_SYMBOLS is defined, when displaying backtraces
* also symbolic names for addresses are dug out.
*/
#define BACKTRACE_SYMBOLS
/*
* TRACE_DEPTH controls how many items in trace will be stored.
* TRACE_START and END offsets will cut trace items from beginning and
* in end of trace so that you can avoid storing unnecessary information
* ie your own malloc wrapper for example
*/
#define TRACE_DEPTH 16
#ifdef __cplusplus
#define TRACE_START_OFFSET 1
#define TRACE_END_OFFSET 1
#else
#define TRACE_START_OFFSET 3
#define TRACE_END_OFFSET 2
#endif
/*
* This will make finding memory blocks faster by using i386 assember
*/
#define I386_FIND_HIGH_BIT
#endif