Changeset fb104b in git
- Timestamp:
- Jun 16, 2010, 3:38:46 PM (13 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
- Children:
- f92fc2ee903caa18ab843a4b7d3e45f1af74c27b
- Parents:
- 2bd9ca3b4643543d25b3d861231b2ab291fa30a2
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2010-06-16 15:38:46+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:55:10+01:00
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r2bd9ca rfb104b 18 18 x86_64-Linux/* 19 19 ix86Mac-darwin/* 20 misc/auxiliary.h 20 21 omalloc/omTables 21 22 omalloc/omTables.h -
misc/auxiliary.h.in
r2bd9ca rfb104b 104 104 105 105 106 /******************************************************************* 107 * DEBUG OPTIONS 108 * -- only significant for for compiling without -DNDEBUG 109 * -- you better know what your are doing, if you touch this 110 ******************************************************************/ 111 #ifndef NDEBUG 112 113 /* undefine to enable inline */ 114 #define NO_INLINE 115 116 /* undefine to disable assume -- should normally be defined for NDEBUG */ 117 #define HAVE_ASSUME 118 119 /* undef PDEBUG to disable checks of polys 120 121 define PDEBUG to 122 0 for enabling pTest 123 1 plus tests in Level 1 poly routines (operations on monomials) 124 2 plus tests in Level 2 poly routines (operations on single exponents) 125 -- see also polys.h for more info 126 127 NOTE: you can set the value of PDEBUG on a per-file basis, before 128 including mod2.h, provided ! PDEBUG is defined in mod2.h E.g.: 129 130 #define PDEBUG 2 131 #include "auxiliary.h" 132 ... 133 134 makes sure that all poly operations in your file are done with 135 PDEBUG == 2 136 To break after an error occured, set a debugger breakpoint on 137 dErrorBreak. 138 */ 139 #ifndef PDEBUG 140 #define PDEBUG 0 141 #endif 142 143 /* define MDEBUG to enable memory checks */ 144 #define MDEBUG 0 145 146 #ifdef MDEBUG 147 /* If ! defined(OM_NDEBUG) and (defined(OM_TRACK) or defined(OM_CHECK) 148 then omDebug routines are used for memory allocation/free: 149 150 The omDebug routines are controlled by the values of OM_TRACK, OM_CHECK 151 and OM_KEEP. There meaning is roughly as follows: 152 OM_TRACK: strored with address : extra space 153 0 : no additional info is stored : 0 154 1 : file:line of location where address was allocated : 1 word 155 2 : plus backtrace of stack where adress was allocated: 6 words 156 3 : plus size/bin info and front-, and back padding : 9 words 157 4 : plus file:line of location where adress was freed : 10 words 158 5 : plus backtrace of stack where adress was allocated: 15 words 159 OM_CHECK: checks done 160 0 : no checks 161 1 : constant-time checks: i.e. addr checks only 162 2 : plus linear-time checks and constant related bin check 163 3 : plus quadratic-time checks and linear-time related bin checks and 164 constant time all memory checks 165 4 : and so on 166 ==> for OM_CHECK >= 3 it gets rather slow 167 OM_KEEP: determines whether addresses are really freed ( 168 0 : addresses are really freed 169 1 : addresses are only marked as free and not really freed. 170 171 OM_CHECK, OM_TRACK, and OM_KEEP can be set on a per-file basis 172 (as can OM_NDEBUG), e.g.: 173 #define OM_CHECK 3 174 #define OM_TRACK 5 175 #define OM_KEEP 1 176 #include "mod2.h" 177 #include "omalloc.h" 178 ensures that all memory allocs/free in this file are done with 179 OM_CHECK==3 and OM_TRACK==5, and that all addresses allocated/freed 180 in this file are only marked as free and never really freed. 181 182 To set OM_CHECK, OM_TRACK and OM_KEEP under dynamic scope, set 183 om_Opts.MinCheck, om_Opts.MinTrack to the respectiv values and 184 om_Opts.Keep to the number of addresses which are kept before they are 185 actually freed. E.g.: 186 int check=om_Opts.MinCheck, track=om_Opts.MinTrack, keep= m_OPts.Keep; 187 om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX; 188 ExternalRoutine(); 189 om_Opts.MinCheck = check; omOpts.MinTrack = track; omOpts.Keep = keep; 190 ensures that all calls omDebug routines occuring during the computation of 191 ExternalRoutine() are done with OM_CHECK==3 and OM_TRACK==5, and 192 calls to omFree only mark addresses as free and not really free them. 193 194 Furthermore, the value of OM_SING_KEEP (resp. om_Opts.Keep) specifies 195 how many addresses are kept before they are actually freed, independently 196 of the value of OM_KEEP. 197 198 Some tips on possible values of OM_TRACK, OM_CHECK, OM_KEEP: 199 + To find out about an address that has been freed twice, first locate the 200 file(s) where the error occured, and then at the beginning of these files: 201 #define OM_CHECK 3 202 #define OM_TRACK 5 203 #define OM_KEEP 1 204 #include "mod2.h" 205 #include "omalloc.h" 206 Under dynamic scope, do (e.g., from within the debugger): 207 om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX; 208 + to find out where "memory corruption" occured, increase value of 209 OM_CHECK - the higher this value is, the more consistency checks are 210 done (However a value > 3 checks the entire memory each time an omalloc 211 routine is used!) 212 213 Some more tips on the usage of omalloc: 214 + omAlloc*, omRealloc*, omFree*, omCheck* omDebug* omTest* rotuines 215 assume that sizes are > 0 and pointers are != NULL 216 + omalloc*, omrealloc*, omfree* omcheck*, omdebug* omtest* routines allow 217 NULL pointers and sizes == 0 218 + You can safely use any free/realloc routine in combination with any alloc 219 routine (including the debug versions): E.g., an address allocated with 220 omAllocBin can be freed with omfree, or an adress allocated with 221 om(Debug)Alloc can be freed with omfree, or omFree, or omFreeSize, etc. 222 However, keep in mind that the efficiency decreases from 223 Bin over Size to General routines (i.e., omFreeBin is more efficient than 224 omFreeSize which is more efficient than omFree, likewise with the alloc 225 routines). 226 + if OM_CHECK is undefined or 0, then all omCheck routines do nothing 227 + if OM_CHECK and OM_TRACK are both undefined (or 0), or if OM_NDEBUG is 228 defined, then the "real" alloc/realloc/free macros are used, and all 229 omTest, omDebug and omCheck routines are undefined 230 + to break after an omError occured within a debugger, 231 set a breakpoint on dErrorBreak 232 + to do checks from within the debugger, or to do checks with explicit 233 check level, use omTest routines. 234 */ 235 236 /* by default, store alloc info and file/line where addr was freed */ 237 #ifndef OM_TRACK 238 #define OM_TRACK 4 239 #endif 240 /* only do constant-time memory checks */ 241 #ifndef OM_CHECK 242 #define OM_CHECK 1 243 #endif 244 /* Do actually free memory: 245 (be careful: if this is set, memory is never really freed, 246 but only marked as free) */ 247 #ifndef OM_KEEP 248 #define OM_KEEP 0 249 #endif 250 /* but only after you have freed 1000 more addresses 251 (this is actually independent of the value of OM_KEEP and used 252 to initialize om_Opts.Keep) */ 253 #ifndef OM_SING_KEEP 254 #define OM_SING_KEEP 1000 255 #endif 256 257 #endif /* MDEBUG */ 258 259 260 /* undef KDEBUG for check of data during std computations 261 * 262 * define KDEBUG to 263 * 0 for basic tests 264 * 1 for tests in kSpoly 265 * NOTE: You can locally enable tests in kspoly by setting the 266 * define at the beginning of kspoly.cc 267 */ 268 #define KDEBUG 0 269 270 /* define LDEBUG checking numbers, undefine otherwise */ 271 #define LDEBUG 272 /* define RDEBUG checking rings (together with TRACE=9) */ 273 #define RDEBUG 274 /* define TEST for non time critical tests, undefine otherwise */ 275 #define TEST 276 277 /* define YYDEBUG 1 for debugging bison texts, 0 otherwise */ 278 #define YYDEBUG 1 279 280 #endif 281 /* end of debugging option (ifndef NDEBUG) */ 282 106 283 #endif 107 284 /* MISC_AUXILIARY_H */
Note: See TracChangeset
for help on using the changeset viewer.