- Timestamp:
- Feb 28, 2014, 10:40:33 AM (10 years ago)
- Branches:
- (u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
- Children:
- 2b7e8f06b94cb0127d7069aa1c20e2354dfd4d0c
- Parents:
- 4fb7e4696a23eaae42105748d89bafdcb0fbe963
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/misc/auxiliary.h.in
r4fb7e4 r118d806 1 1 /*****************************************************************************\ 2 * Computer Algebra System SINGULAR 2 * Computer Algebra System SINGULAR 3 3 \*****************************************************************************/ 4 4 /** @file auxiliary.h 5 * 5 * 6 6 * All the auxiliary stuff. 7 7 * … … 66 66 #endif 67 67 68 #endif 68 #endif 69 69 // #ifdef HAVE_FACTORY 70 70 71 71 // ---------------- end of parts/extensions 72 // ----------------- configure stuff73 74 // TODO: the following should go to some config.h... no?75 76 /* Absolute pathname of root directory of Singular source */77 #ifndef S_ROOT_DIR78 #define S_ROOT_DIR ""79 #endif80 81 /* Singular\'s own uname\ */82 #ifndef S_UNAME83 #define S_UNAME ""84 #endif85 // ----------------- end of configure stuff86 72 87 73 // ---------------- Singular standard types etc. … … 221 207 ... 222 208 223 makes sure that all poly operations in your file are done with 209 makes sure that all poly operations in your file are done with 224 210 PDEBUG == 2 225 211 To break after an error occured, set a debugger breakpoint on 226 dErrorBreak. 212 dErrorBreak. 227 213 */ 228 214 #ifndef PDEBUG … … 258 244 1 : addresses are only marked as free and not really freed. 259 245 260 OM_CHECK, OM_TRACK, and OM_KEEP can be set on a per-file basis 246 OM_CHECK, OM_TRACK, and OM_KEEP can be set on a per-file basis 261 247 (as can OM_NDEBUG), e.g.: 262 248 #define OM_CHECK 3 … … 265 251 #include <kernel/mod2.h> 266 252 #include <omalloc/omalloc.h> 267 ensures that all memory allocs/free in this file are done with 268 OM_CHECK==3 and OM_TRACK==5, and that all addresses allocated/freed 253 ensures that all memory allocs/free in this file are done with 254 OM_CHECK==3 and OM_TRACK==5, and that all addresses allocated/freed 269 255 in this file are only marked as free and never really freed. 270 271 To set OM_CHECK, OM_TRACK and OM_KEEP under dynamic scope, set 272 om_Opts.MinCheck, om_Opts.MinTrack to the respectiv values and 273 om_Opts.Keep to the number of addresses which are kept before they are 256 257 To set OM_CHECK, OM_TRACK and OM_KEEP under dynamic scope, set 258 om_Opts.MinCheck, om_Opts.MinTrack to the respectiv values and 259 om_Opts.Keep to the number of addresses which are kept before they are 274 260 actually freed. E.g.: 275 261 int check=om_Opts.MinCheck, track=om_Opts.MinTrack, keep= m_OPts.Keep; … … 278 264 om_Opts.MinCheck = check; omOpts.MinTrack = track; omOpts.Keep = keep; 279 265 ensures that all calls omDebug routines occuring during the computation of 280 ExternalRoutine() are done with OM_CHECK==3 and OM_TRACK==5, and 266 ExternalRoutine() are done with OM_CHECK==3 and OM_TRACK==5, and 281 267 calls to omFree only mark addresses as free and not really free them. 282 268 283 Furthermore, the value of OM_SING_KEEP (resp. om_Opts.Keep) specifies 284 how many addresses are kept before they are actually freed, independently 269 Furthermore, the value of OM_SING_KEEP (resp. om_Opts.Keep) specifies 270 how many addresses are kept before they are actually freed, independently 285 271 of the value of OM_KEEP. 286 272 … … 295 281 Under dynamic scope, do (e.g., from within the debugger): 296 282 om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX; 297 + to find out where "memory corruption" occured, increase value of 298 OM_CHECK - the higher this value is, the more consistency checks are 299 done (However a value > 3 checks the entire memory each time an omalloc 283 + to find out where "memory corruption" occured, increase value of 284 OM_CHECK - the higher this value is, the more consistency checks are 285 done (However a value > 3 checks the entire memory each time an omalloc 300 286 routine is used!) 301 287 302 288 Some more tips on the usage of omalloc: 303 + omAlloc*, omRealloc*, omFree*, omCheck* omDebug* omTest* rotuines 289 + omAlloc*, omRealloc*, omFree*, omCheck* omDebug* omTest* rotuines 304 290 assume that sizes are > 0 and pointers are != NULL 305 291 + omalloc*, omrealloc*, omfree* omcheck*, omdebug* omtest* routines allow 306 292 NULL pointers and sizes == 0 307 + You can safely use any free/realloc routine in combination with any alloc 293 + You can safely use any free/realloc routine in combination with any alloc 308 294 routine (including the debug versions): E.g., an address allocated with 309 omAllocBin can be freed with omfree, or an adress allocated with 295 omAllocBin can be freed with omfree, or an adress allocated with 310 296 om(Debug)Alloc can be freed with omfree, or omFree, or omFreeSize, etc. 311 However, keep in mind that the efficiency decreases from 297 However, keep in mind that the efficiency decreases from 312 298 Bin over Size to General routines (i.e., omFreeBin is more efficient than 313 299 omFreeSize which is more efficient than omFree, likewise with the alloc 314 300 routines). 315 301 + if OM_CHECK is undefined or 0, then all omCheck routines do nothing 316 + if OM_CHECK and OM_TRACK are both undefined (or 0), or if OM_NDEBUG is 317 defined, then the "real" alloc/realloc/free macros are used, and all 302 + if OM_CHECK and OM_TRACK are both undefined (or 0), or if OM_NDEBUG is 303 defined, then the "real" alloc/realloc/free macros are used, and all 318 304 omTest, omDebug and omCheck routines are undefined 319 + to break after an omError occured within a debugger, 305 + to break after an omError occured within a debugger, 320 306 set a breakpoint on dErrorBreak 321 + to do checks from within the debugger, or to do checks with explicit 307 + to do checks from within the debugger, or to do checks with explicit 322 308 check level, use omTest routines. 323 309 */ … … 331 317 #define OM_CHECK 1 332 318 #endif 333 /* Do actually free memory: 334 (be careful: if this is set, memory is never really freed, 319 /* Do actually free memory: 320 (be careful: if this is set, memory is never really freed, 335 321 but only marked as free) */ 336 322 #ifndef OM_KEEP 337 323 #define OM_KEEP 0 338 324 #endif 339 /* but only after you have freed 1000 more addresses 325 /* but only after you have freed 1000 more addresses 340 326 (this is actually independent of the value of OM_KEEP and used 341 327 to initialize om_Opts.Keep) */ … … 347 333 348 334 349 /* undef KDEBUG for check of data during std computations 335 /* undef KDEBUG for check of data during std computations 350 336 * 351 337 * define KDEBUG to 352 338 * 0 for basic tests 353 * 1 for tests in kSpoly 354 * NOTE: You can locally enable tests in kspoly by setting the 339 * 1 for tests in kSpoly 340 * NOTE: You can locally enable tests in kspoly by setting the 355 341 * define at the beginning of kspoly.cc 356 342 */ … … 369 355 #define YYDEBUG 1 370 356 371 #endif 357 #endif 372 358 /* end of debugging option (ifndef SING_NDEBUG) */ 373 359 … … 457 443 458 444 459 #endif 445 #endif 460 446 /* MISC_AUXILIARY_H */ 461 447
Note: See TracChangeset
for help on using the changeset viewer.