📄 settings.dist
字号:
/* * Manual configuration flags * * Copyright 2000 by Gray Watson * * This file is part of the dmalloc package. * * Permission to use, copy, modify, and distribute this software for any * purpose and without fee is hereby granted, provided * that the above copyright notice and this permission notice appear * in all copies, and that the name of Gray Watson not be used in * advertising or publicity pertaining to distribution of the document * or software without specific, written prior permission. * * Gray Watson makes no representations about the suitability of the * software described herein for any purpose. It is provided "as is" * without express or implied warranty. * * The author may be contacted via http://dmalloc.com/ * * $Id: settings.dist,v 1.68 2004/09/13 05:14:04 gray Exp $ *//* * PROGRAMMING NOTE: this file cannot be included before conf.h, so * you might as well only include conf.h and never this file. */#ifndef __SETTINGS_H__#define __SETTINGS_H__/* * Should we allow zero length allocations? This will generate the * smallest possible allocation. * * FYI: if fence post checking is requested, the top and bottom of the * fence post information will be touching. */#define ALLOW_ALLOC_ZERO_SIZE 1/* * Should we allow realloc of a NULL pointer? If set to one, this * will call malloc when 0L is realloc-ed. This is useful when you * are extending an array in a loop and do not want to allocate it * specially the first time. */#define ALLOW_REALLOC_NULL 1/* * Should we allow realloc to a 0 size to cause the pointer to be * freed? If set to one, this will call free when a pointer is * realloc-ed to a size of 0. Thanks to Stefan Froehlich * for patiently pointing that the realloc in just about every Unix * has this functionality. */#define ALLOW_REALLOC_SIZE_ZERO 1/* * I have swayed to public pressure and allowing free(0L) is now the * default. Sigh. :-) * * Should we allow the free of a NULL pointer and if it happens, * should a message be generated to that effect. Most (if not all) * POSIX C libraries allow you to free() or delete() a NULL pointer * and a number of programming reference manuals mention that freeing * of NULL is "allowed". However, I believe that it is bad form, * promotes lazy pointer handling, and can often hide program bugs. I * encourage you to do something like the following in your programs: * if (pnt != NULL) { free(pnt); } * * Setting ALLOW_FREE_NULL to 0 will cause an exception whenever a * free of NULL is encountered allowing the user to determine where * s/he is freeing a possibly random pointer. I recommend at least * logging a message with the ALLOW_FREE_NULL_MESSAGE set to 1. * * Even with ALLOW_FREE_NULL set to 1, you can enable the * 'error-free-null' token at runtime for a specific program to * generate an exception when it sees a free(0L). */#define ALLOW_FREE_NULL 1#define ALLOW_FREE_NULL_MESSAGE 1/* * Should we use the ra-address macros in return.h. These are system * specific macros designed to return the return-address for logging * callers (i.e. possible offenders) of malloc routines. * * Please mail me if you have any questions with this functionality. */#define USE_RETURN_MACROS 1/* * Write this character into memory when it is allocated and not * calloc-ed if the alloc-blank token is enabled. It will also write * this into realloc'd memory which you extend or reduce. You can * verify that these sections have not been overwritten with the * check-blank token. * * \332 == 0xda, 0332, decimal 218 (i.e. dmalloc-alloc) */#define ALLOC_BLANK_CHAR '\332'/* * Write this character into memory when it is freed if the free-blank * token is enabled. You can verify that these sections have not been * overwritten with the check-blank token. * * \337 == 0xdf, 0337, decimal 223 (i.e. dmalloc-free) */#define FREE_BLANK_CHAR '\337'/* * The following information sets limits on the size of the source * file name and line numbers returned by the __FILE__ and __LINE__ * compiler macros. You may need to tune then to fit your environment * although I would argue that if you have filenames longer than 40 * characters or files longer than 10,000 lines, you are doing * something wrong. * * MIN_FILE_LENGTH 3 => file "[a-zA-Z].c" * * Set MAX_FILE_LENGTH or MAX_LINE_NUMBER to be 0 to disable checks. * * NOTE: if the max is changed then the dmalloc.texi file reference to * it will need to be changed too. */#define MIN_FILE_LENGTH 3#define MAX_FILE_LENGTH 100#define MAX_LINE_NUMBER 30000/* * The largest allowable allocation size. This is only for * verification purposes to control allocations of bizarre sizes. Any * allocation larger than this will generate a ERROR_TOO_BIG error. * * Set to 0 to disable the test altogether. */#define LARGEST_ALLOCATION 268435456UL /* 256 mb *//* * Automatically call dmalloc_shutdown if on_exit or atexit is * available. See conf.h for whether configure found on_exit or * atexit calls. If neither is available, your program will have to * call dmalloc_shutdown yourself before it exits. You can also take * a look at atexit.c in the contrib directory which may provide this * useful functionality for your system. * * NOTE: If you are having problems with the library going recursive (see * LOCK_THREADS below if you are using pthreads), you might want to * try setting this to 0. Because the library makes a call to on_exit * or atexit to register itself, it may cause memory transactions by * the system causing the dreaded recursive message. You may then be * forced to register dmalloc_shutdown yourself via on_exit or atexit * in main() or call dmalloc_shutdown directly before you exit(). */#define AUTO_SHUTDOWN 1/* * The ABORT_OKAY is auto-configured but may have to be adjusted by * forcing the USE_ABORT to be 1 or 0. On some OS's, abort calls * fclose() which may want to free memory making the library go * recursive when it is aborting. See ABORT_OKAY in the conf.h file * for more information. * * If you need to override it or if ABORT_OKAY is 0, set KILL_PROCESS to * the proper way to stop the program. Killing the current process * (id 0) with SIGABRT works on a number of Unix systems. You may * have to define some include file to get the value for the signal * that is used. */#if ABORT_OKAY#define USE_ABORT 1#else#define USE_ABORT 0#endif#if SIGNAL_OKAY#define KILL_INCLUDE <signal.h>#define KILL_PROCESS (void)kill(0, SIGABRT)#endif/* * Define the signals that are to be caught by the catch-signals * token. When caught, these signals will cause an automatic shutdown * of the library so that the not-freed memory and other statistics will * be displayed. Thanks Marty. */#if SIGNAL_OKAY#define SIGNAL1 SIGHUP#define SIGNAL2 SIGINT#define SIGNAL3 SIGTERM#undef SIGNAL4#undef SIGNAL5#undef SIGNAL6#endif/* * Number of bytes to write at the top of allocations (if fence-post * checking is enabled). A larger number means more memory space used * up but better protection against fence overruns. See the manual * for more information. */#define FENCE_TOP_SIZE 4/* * Number of bytes to write at the bottom of allocations. See the * FENCE_TOP_SIZE setting above or the manual for more information. * * WARNING: this should changed with caution and probably should only be * increased. If you need to change it, use (ALLOCATION_ALIGNMENT * * X) or some such. For more information see ALLOCATION_ALIGNMENT in * conf.h. */#define FENCE_BOTTOM_SIZE ALLOCATION_ALIGNMENT/* * Amount of space that we are to display whenever we need to dump a * pointer's contents to a log file or stream. This should be more * than FENCE_BOTTOM_SIZE and FENCE_TOP_SIZE. */#define DUMP_SPACE 20/* * At the front of each log message, print the output from the time() * call as a number. This requires that the time function be defined. */#define LOG_TIME_NUMBER 1#define TIME_INCLUDE <time.h>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -