📄 config.h
字号:
#ifndef MP_CONFIG_H#define MP_CONFIG_H/* * mpatrol * A library for controlling and tracing dynamic memory allocations. * Copyright (C) 1997-2002 Graeme S. Roy <graeme.roy@analog.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307, USA. *//* * Library configuration. All configuration constants for the mpatrol * library are defined here. *//* * $Id: config.h,v 1.87 2002/01/08 20:13:59 graeme Exp $ */#include "target.h"/* The keywords used to specify the visibility of all internal support * functions and variables within the library. If the library is composed * of separate object modules then functions in one translation unit may * need to call functions in another translation unit even though they * should not be visible to the user. */#ifndef MP_EXPORT#define MP_EXPORT extern#endif /* MP_EXPORT */#ifndef MP_GLOBAL#define MP_GLOBAL#endif /* MP_GLOBAL *//* The keyword used to specify the visibility of functions and variables which * are part of the library API. */#ifndef MP_API#define MP_API#endif /* MP_API *//* The keywords used to specify a constant variable or parameter and a variable * that should not have accesses to it optimised away. These may only be * supported by ANSI C or C++ compilers so they are defined under a macro just * in case. Note that constness is really only used for the highest-level * functions in the library to prevent clashes with any functions that are * being overridden, and volatility is only used to prevent RCS identification * strings from being removed by an optimising compiler. */#ifndef MP_CONST#if defined(__STDC__) || defined(__cplusplus)#define MP_CONST const#else /* __STDC__ && __cplusplus */#define MP_CONST#endif /* __STDC__ && __cplusplus */#endif /* MP_CONST */#ifndef MP_VOLATILE#if defined(__STDC__) || defined(__cplusplus)#define MP_VOLATILE volatile#else /* __STDC__ && __cplusplus */#define MP_VOLATILE#endif /* __STDC__ && __cplusplus */#endif /* MP_VOLATILE *//* Indicates if preprocessor macro versions of some internal library routines * should be used instead of their function equivalents in order to increase * run-time efficiency. This might not be desirable if the library needs to be * run under a debugger. */#ifndef MP_MACROROUTINES#define MP_MACROROUTINES 1#endif /* MP_MACROROUTINES *//* Indicates if system memory should be allocated from a static array rather * than the process heap. Use this to provide support for dynamic memory * allocation routines on systems that don't have a system function to allocate * heap memory. */#ifndef MP_ARRAY_SUPPORT#if TARGET == TARGET_ANY#define MP_ARRAY_SUPPORT 1#else /* TARGET */#define MP_ARRAY_SUPPORT 0#endif /* TARGET */#endif /* MP_ARRAY_SUPPORT *//* The size of the static memory array in bytes. Any attempt to allocate more * system memory than this will fail, although it should be remembered that the * library will also be using this array for its internal structures. The * default is 1 megabyte. */#if MP_ARRAY_SUPPORT#ifndef MP_ARRAY_SIZE#define MP_ARRAY_SIZE 1048576#endif /* MP_ARRAY_SIZE */#endif /* MP_ARRAY_SUPPORT *//* The number of entries in the function and file name caches. These caches * are used when tracing in order to keep the size of the tracing output file * down. The caches will reuse their oldest entries when they are full. Note * that the size of the caches cannot be greater than 127 entries. */#ifndef MP_NAMECACHE_SIZE#define MP_NAMECACHE_SIZE 32#endif /* MP_NAMECACHE_SIZE *//* The number of entries in the memory reservation cache. This cache is used * when tracing in order to store information about heap memory reservations * before the tracing output file has been opened. If the number of entries * to store exceeds this number then all subsequent entries will be discarded * until the tracing output file has been opened. */#ifndef MP_RESCACHE_SIZE#define MP_RESCACHE_SIZE 256#endif /* MP_RESCACHE_SIZE *//* The size of the simulated UNIX heap in bytes. This is used by the brk() and * sbrk() functions on non-UNIX platforms and is used to allocate a block of * memory of this size. Any attempt to allocate memory beyond this block will * cause these functions to fail. */#ifndef MP_BREAK_SIZE#define MP_BREAK_SIZE 262144#endif /* MP_BREAK_SIZE *//* The size of the input line buffer in bytes in the mptrace and mleak tools. * If any of the entries in the tracing output file or any of the lines in the * log file are longer than this then an error message will be generated and * mptrace or mleak will terminate. */#ifndef MP_BUFFER_SIZE#define MP_BUFFER_SIZE 8192#endif /* MP_BUFFER_SIZE *//* The number of allocation bins to use when profiling. Details of memory * allocations of all sizes up to the bin size will be recorded in a table and * written to the profiling output file at program termination. */#ifndef MP_BIN_SIZE#define MP_BIN_SIZE 1024#endif /* MP_BIN_SIZE *//* The number of buckets in the hash table used to implement the string table. * This must be a prime number. */#ifndef MP_HASHTAB_SIZE#define MP_HASHTAB_SIZE 211#endif /* MP_HASHTAB_SIZE *//* The number of buckets in the hash table used to implement the leak table. * This must be a prime number. */#ifndef MP_LEAKTAB_SIZE#define MP_LEAKTAB_SIZE 47#endif /* MP_LEAKTAB_SIZE *//* The multiple of pages to allocate from the heap every time a new block of * internal memory is required. The higher the value, the less distinct * internal blocks to keep track of, but the potential for more memory wastage * if not all of the block is required. */#ifndef MP_ALLOCFACTOR#define MP_ALLOCFACTOR 4#endif /* MP_ALLOCFACTOR *//* The maximum number of recursive calls to C++ operator delete and operator * delete[] that will have source level information associated with them. * This acts as a workaround for the fact that placement delete will only be * called during an exception and not if explicitly invoked. However, the * current implementation is not thread-safe. */#ifndef MP_MAXDELSTACK#define MP_MAXDELSTACK 32#endif /* MP_MAXDELSTACK *//* The maximum number of initialisation and finalisation functions that can * be registered with the mpatrol library through the __mp_init_*() functions * and through the __mp_atexit() function respectively. The initialisation * functions are called in order of discovery when __mp_init() is called and * the finalisation functions are called in reverse order when __mp_fini() * is called. */#ifndef MP_MAXINITS#define MP_MAXINITS 32#endif /* MP_MAXINITS */#ifndef MP_MAXFINIS#define MP_MAXFINIS 32#endif /* MP_MAXFINIS *//* Indicates if all of the heap memory used by the library should be * deleted when the process exits. This should not be set on systems that * make dynamic memory allocations after exit() or reference freed memory * at process termination, and really only needs to be set on systems that * do not reclaim memory from a process when it terminates. */#ifndef MP_DELETEHEAP#if TARGET == TARGET_UNIX || TARGET == TARGET_WINDOWS#define MP_DELETEHEAP 0#else /* TARGET */#define MP_DELETEHEAP 1#endif /* TARGET */#endif /* MP_DELETEHEAP *//* Indicates if the system supports memory protection. If not, then the * NOPROTECT option will always be used to prevent needless function calls * and the PAGEALLOC option will have no effect. */#ifndef MP_PROTECT_SUPPORT#if TARGET == TARGET_UNIX || TARGET == TARGET_WINDOWS#define MP_PROTECT_SUPPORT 1#else /* TARGET */#define MP_PROTECT_SUPPORT 0#endif /* TARGET */#endif /* MP_PROTECT_SUPPORT *//* Indicates if the system supports the memalign() function call to allocate * memory with a specified alignment. This is used by mpalloc.c to implement * release versions of memalign(), valloc() and pvalloc(). */#ifndef MP_MEMALIGN_SUPPORT#if defined(HAVE_CONFIG_H) && defined(HAVE_MEMALIGN)#define MP_MEMALIGN_SUPPORT 1#else /* HAVE_CONFIG_H && HAVE_MEMALIGN */#if SYSTEM == SYSTEM_CYGWIN || SYSTEM == SYSTEM_DGUX || \ SYSTEM == SYSTEM_DRSNX || SYSTEM == SYSTEM_IRIX || \ SYSTEM == SYSTEM_LINUX || SYSTEM == SYSTEM_SOLARIS || \ SYSTEM == SYSTEM_SUNOS || SYSTEM == SYSTEM_UNIXWARE#define MP_MEMALIGN_SUPPORT 1#else /* SYSTEM */#define MP_MEMALIGN_SUPPORT 0#endif /* SYSTEM */#endif /* HAVE_CONFIG_H && HAVE_MEMALIGN */#endif /* MP_MEMALIGN_SUPPORT *//* Indicates if a UNIX system supports the mmap() function call to allocate * memory as well as sbrk(). This must only be set if the system also supports * the allocation of zero-initialised pages from either a special device file * or via a special flag. Note that sbrk() will still be used by default, but * mmap() will be used to allocate memory that is internal to the mpatrol * library. The USEMMAP option can be used to switch this behaviour. */#ifndef MP_MMAP_SUPPORT#if defined(HAVE_CONFIG_H) && defined(HAVE_MMAP)#define MP_MMAP_SUPPORT 1#else /* HAVE_CONFIG_H && HAVE_MMAP */#if SYSTEM == SYSTEM_AIX || SYSTEM == SYSTEM_CYGWIN || \ SYSTEM == SYSTEM_DGUX || SYSTEM == SYSTEM_DRSNX || \ SYSTEM == SYSTEM_DYNIX || SYSTEM == SYSTEM_FREEBSD || \ SYSTEM == SYSTEM_HPUX || SYSTEM == SYSTEM_IRIX || \ SYSTEM == SYSTEM_LINUX || SYSTEM == SYSTEM_NETBSD || \ SYSTEM == SYSTEM_OPENBSD || SYSTEM == SYSTEM_SINIX || \ SYSTEM == SYSTEM_SOLARIS || SYSTEM == SYSTEM_SUNOS || \ SYSTEM == SYSTEM_TRU64 || SYSTEM == SYSTEM_UNIXWARE#define MP_MMAP_SUPPORT 1#else /* SYSTEM */#define MP_MMAP_SUPPORT 0#endif /* SYSTEM */#endif /* HAVE_CONFIG_H && HAVE_MMAP */#endif /* MP_MMAP_SUPPORT *//* Indicates if the mmap() function call supports the MAP_ANON or MAP_ANONYMOUS * flag for allocating zero-filled pages. If it doesn't then the filename * specified by MP_MMAP_FILENAME will be used instead. */#if MP_MMAP_SUPPORT#ifndef MP_MMAP_ANONYMOUS#if SYSTEM == SYSTEM_AIX || SYSTEM == SYSTEM_CYGWIN || \ SYSTEM == SYSTEM_DYNIX || SYSTEM == SYSTEM_FREEBSD || \ SYSTEM == SYSTEM_HPUX || SYSTEM == SYSTEM_LINUX || \ SYSTEM == SYSTEM_NETBSD || SYSTEM == SYSTEM_OPENBSD || \ SYSTEM == SYSTEM_TRU64 || SYSTEM == SYSTEM_UNIXWARE#define MP_MMAP_ANONYMOUS 1#else /* SYSTEM */#define MP_MMAP_ANONYMOUS 0#endif /* SYSTEM */#endif /* MP_MMAP_ANONYMOUS */#endif /* MP_MMAP_SUPPORT *//* The full path to a special device file which contains an infinite number of * zero bytes. This is used with mmap() in order to allocate zero-filled pages. */#if MP_MMAP_SUPPORT#ifndef MP_MMAP_FILENAME#define MP_MMAP_FILENAME "/dev/zero"#endif /* MP_MMAP_FILENAME */#endif /* MP_MMAP_SUPPORT *//* Indicates if a UNIX system supports the mincore() function call to * determine if a memory mapping is in core. */#ifndef MP_MINCORE_SUPPORT#if defined(HAVE_CONFIG_H) && defined(HAVE_MINCORE)#define MP_MINCORE_SUPPORT 1#else /* HAVE_CONFIG_H && HAVE_MINCORE */#if SYSTEM == SYSTEM_AIX || SYSTEM == SYSTEM_DGUX || SYSTEM == SYSTEM_DRSNX || \ SYSTEM == SYSTEM_FREEBSD || SYSTEM == SYSTEM_NETBSD || \ SYSTEM == SYSTEM_OPENBSD || SYSTEM == SYSTEM_SOLARIS || \ SYSTEM == SYSTEM_SUNOS || SYSTEM == SYSTEM_UNIXWARE#define MP_MINCORE_SUPPORT 1#else /* SYSTEM */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -