.ccmalloc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %%%% generic configuration file for %%%%
  3. %%%% the ccmalloc memory profiler %%%%
  4. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5. %-----------------------------------------------------------------%
  6. % COPY THIS FILE TO '.ccmalloc' in your project or home directory %
  7. %-----------------------------------------------------------------%
  8. ##############################################################################
  9. ## (C) 1997-2003 Armin Biere, 1998 Johannes Keukelaar
  10. ## $Id: ccmalloc.cfg,v 1.6 2003/02/03 08:03:54 biere Exp $
  11. ##############################################################################
  12. %%% '%' and '#' are comments !!!!!!!
  13. % This file must be called '.ccmalloc' and is searched for in the
  14. % current directory and in the home directory of the user. If it
  15. % does not exist then the default values mentioned below are used.
  16. % It is also the only available user manual yet ;-) So here is a reading
  17. % hint. First have a look at the short one line descriptions of each option
  18. % ...
  19. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  20. % with 'file' the executable is specified [a.out]
  21. % ----------------------------------------------------------------------
  22. % This should not be necessary for Linux and Solaris because the proc
  23. % file system can be used to find argv[0].
  24. %
  25. % (the rest of this comment only applies to other OS)
  26. %
  27. % For other OS you should use this option unless the executable is
  28. % in the current directory or its name is 'a.out'.
  29. %
  30. % If you do not specify this then ccmalloc tries to find an executable
  31. % in the current directory that matches the running program starting
  32. % with 'a.out'. For this process it must call 'nm' on each executable
  33. % file in the directory which may be time consuming. With this option
  34. % you can speed up this process.
  35. %
  36. % You can also specify absolute or relative path names. This is
  37. % necessary if you do not start your program from the current directory.
  38. % But you can also simply link or name your program to 'a.out'.
  39. %file FILE
  40. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  41. % 'log' specify the logfile [stderr]
  42. % ----------------------------------------------------------------------
  43. % The default is to use stderr. The argument to 'log' is the name of
  44. % the file you want to write to. It can also be 'stdout' or '-' which
  45. % sets stdout as logfile. If the logfile is stdout or stderr and is
  46. % connected to a terminal then the output is slightly different.
  47. %
  48. % For big programs the logfile can be really big. To reduce the size
  49. % you can use a small chain length (see 'chain-length' below). The other
  50. % possibility is to use compressed logfiles. This can be done by
  51. % specifying a logfile name with a '.gz' (or a '.Z') suffix. This means
  52. % that gnuzip (resp. compress) is used to compress the output.
  53. %log FILE
  54. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  55. % 'logpid' specify the logfile
  56. % ----------------------------------------------------------------------
  57. % Can be used alternatively to the 'log' command if you want to use
  58. % ccmalloc for debugging parallel applications where several copies of
  59. % the program you are debugging must be run simoultaneously. In this
  60. % case you can not use 'log' because you do not want to write to the same
  61. % log file. Using 'logpid' uses a file name ending with the <pid> of
  62. % the process which means the name is unique even if several copies of
  63. % your program are run simoultaneously.
  64. %
  65. % If you use the compressing suffixes then the <pid> is inserted before
  66. % the suffix (e.g. 'logpid ccmalloc.log.gz' uses 'ccmalloc.log.<pid>.gz'
  67. % as the name for the log file).
  68. %logpid FILE
  69. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  70. % 'dont-log-chain' skip info about certain chains []
  71. % ----------------------------------------------------------------------
  72. % This command may be repeated any number of times. The argument to this
  73. % command is a comma-separated list of function-or-file-and-line
  74. % specifications. Garbage allocated from a callchain that contains this
  75. % subchain anywhere will _not_ be logged.
  76. %
  77. % The ';'-separated list should not contain any spaces. E.g. not:
  78. %
  79. % main ; foo ; bar
  80. %
  81. % but:
  82. %
  83. % main;foo;bar
  84. %
  85. % A function-or-file-and-line specification is a string followed by an
  86. % optional colon and number, for example: main or main:14 or main.c or
  87. % main.c:15. Note that the string is compared with both the function and the
  88. % file name, if available. If main.c happens to be a function name, that
  89. % will cause a match (for that string at least). Not specifying a line
  90. % number will match any line number. If line number information is not
  91. % available, anything will match! Not specifying a name (e.g. ;;;) will
  92. % match an unknown function name. Not giving any parameters at all, will
  93. % match a chain containing at least one unknown function.
  94. %
  95. % Note that if you say 'dont-log-chain wrapper.c' nothing will be logged.
  96. %dont-log-chain
  97. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  98. % 'only-log-chain' skip info about other chains []
  99. % ----------------------------------------------------------------------
  100. % The obvious counterpart to dont-log-chain. In this case, only matching
  101. % chains will be reported. Non-matching chains will not be reported.
  102. % Can be repeated any number of times; if the chain matches any of the
  103. % instances, it will be reported.
  104. %only-log-chain
  105. ########################################################################
  106. # #
  107. # This is the 'flag' section #
  108. # #
  109. # 'set FLAG' is the same as 'set FLAG 1' #
  110. # #
  111. # The default values are those set below. If 'silent' is disabled #
  112. # then you will find the banner in the log file (or it is listed on #
  113. # stdout or stderr). The banner describes the current settings of all #
  114. # these flags. #
  115. # #
  116. ########################################################################
  117. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  118. % with 'only-count' ccmalloc only counts garbage - no call chains [0]
  119. % ----------------------------------------------------------------------
  120. % If only-count is set to one then only one additional pointer for
  121. % each allocated data is used and no call chain is generated. This is
  122. % the fasted and most space efficient mode ccmalloc can operate
  123. % in. In this mode you get at least the size of garbage produced.
  124. %
  125. % Note that 'check-free-space' does not work at all with 'only-count'
  126. % set and over writes ('check-overwrites') are only checked when
  127. % calling free.
  128. %set only-count 0
  129. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  130. % 'load-dynlibs' load dynamic linked libraries into gdb [0]
  131. % ----------------------------------------------------------------------
  132. % If your program is linked with dynamic libraries, function and file
  133. % name information is not available for addresses in those libraries,
  134. % unless you set 'load-dynlibs' to 1.
  135. %set load-dynlibs 0
  136. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  137. % 'keep-deallocated-data' does not recycle deallocated data [0]
  138. % ----------------------------------------------------------------------
  139. % If you enable keep-deallocated-data then all data deallocated with
  140. % 'free' (or 'delete' in C++) is not given back to the free store
  141. % but stays associated with the call chain of its allocation. This is
  142. % very useful if your program does multiple deallocation of the
  143. % same data.
  144. %set keep-deallocated-data 0
  145. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  146. % 'check-overwrites' detect overwrites [0]
  147. % ----------------------------------------------------------------------
  148. % If you want to detect 'off by n bytes' errors you should set
  149. % 'checking-overwrites' to n/4 (on 32-Bit machines).
  150. %
  151. % ccmalloc inserts a boundary above allocated data. This boundary
  152. % consists of 'check-overwrites' words. If your program writes to
  153. % this area then ccmalloc can detect this (see also check-start
  154. % and check-interval). 'ccmalloc' also does checking for overwrites
  155. % at non word boundaries (e.g. strcpy(malloc(strlen("hello")),"hello");)
  156. set check-overwrites 1
  157. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  158. % 'check-underwrites' detect underwrites [0]
  159. % ----------------------------------------------------------------------
  160. % same with writes below allocated data. You do not have to set this
  161. % option if you only want detect 'off (below) by one' errors because
  162. % ccmalloc keeps a magic value just before the user data.
  163. set check-underwrites 1
  164. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  165. % 'check-free-space' can be used to find dangling pointers. [0]
  166. % ----------------------------------------------------------------------
  167. % A very serious type of bug is to write on data that has already been
  168. % freed. If this happens the free space management of malloc is in
  169. % trouble and you will perhaps encounter non deterministic behaviour of
  170. % your program. To test this first enable 'keep-deallocated-data' and
  171. % restart your program. If the problem goes away and ccmalloc does not
  172. % report anything then you should *also* enable 'check-free-space'. Now
  173. % ccmalloc checks already deallocated data for corruption.
  174. %
  175. % Note that to perform this check 'keep-deallocated-data' also must
  176. % be enabled and 'only-count' disabled.
  177. set check-free-space 1
  178. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  179. % 'check-interval' can be used to speed up checks [0]
  180. % ----------------------------------------------------------------------
  181. % If check-overwrite, check-underwrites or check-free-space is set then
  182. % the default is to do 'write checks' when data is deallocated and
  183. % to do 'free space checks' when reporting together with
  184. % 'write checks' for garbage. When you want these checks to be
  185. % performed more often then you should set 'check-interval' to a
  186. % positive number. This number is the interval between the number of
  187. % calls to free or malloc without performing the checks.
  188. %set check-interval 0
  189. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  190. % 'check-start' can be used to speed up checks [0]
  191. % ----------------------------------------------------------------------
  192. % The flag 'check-start' delays the start of checks until the given
  193. % number of calls to free and malloc have occured. Together with
  194. % 'check-interval' you can use a binary search to find an aproximation
  195. % when a corruption occured! If you simply set check-interval to 1 and
  196. % check-start to 0 then this will slow done your program too much.
  197. %set check-start 0
  198. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  199. % 'silent' disables banner [0]
  200. % ----------------------------------------------------------------------
  201. % If you don't want to see the banner of ccmalloc then set
  202. % 'silent' to 1 (f.e. when logging to stderr)
  203. %set silent
  204. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  205. % 'file-info' en/disables file and line number information [1]
  206. % ----------------------------------------------------------------------
  207. % If your program was compiled with debugging information (-g) then
  208. % ccmalloc can generate line number and file info for call chains opening
  209. % a pipe to gdb. For very big programs this method is slow. In this case
  210. % you can set 'file-info' to zero and you will only get the function
  211. % names. For SunOS 4.3.1 'nm' does not 'demangle' C++ identifiers
  212. % very well. So gdb is called instead but only if 'file-info' is
  213. % not set to 0.
  214. %set file-info 1
  215. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  216. % 'continue' if ccmalloc aborts when something weired happened [0]
  217. % ----------------------------------------------------------------------
  218. % If the free function of ccmalloc is called with an argument that does
  219. % not make sense to ccmalloc or that has already been freed then you
  220. % probably want the program to stop at this point. This is also
  221. % the default behaviour. But you can force ccmalloc also to ignore
  222. % this if you set 'continue' to 1. This flag also controls the behaviour
  223. % of ccmalloc when free space is found to be corrupted or a write
  224. % boundary has been overwritten.
  225. %set continue 0
  226. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  227. % 'chain-length' is the length of the maximal call chain [0 = infinite]
  228. % ----------------------------------------------------------------------
  229. % You can restrict the length of call chains by setting 'chain-length'
  230. % to a number greater than zero. If 'chain-length' is zero (the default)
  231. % then chains are as long as possible (on a non x86 system only call
  232. % chains with a finite maximal length can be generated). For big
  233. % programs especially if keep-deallocated-data is enabled this can
  234. % reduce the size of the log file from over 100MB to several MB!
  235. %set chain-length 0
  236. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  237. % 'print-addresses' of data [0]
  238. % ----------------------------------------------------------------------
  239. % If you want to see the addresses of the allocated data (and
  240. % deallocated data if keep-deallocated-data is set to 1) set
  241. % 'print-addresses' to 1.
  242. %set print-addresses 0
  243. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  244. % 'print-on-one-line' shortens log file [0]
  245. % ----------------------------------------------------------------------
  246. % The default is to print function names and file/line number info
  247. % on separate lines. With 'print-on-one-line' set 1 all are printed
  248. % on one line.
  249. %set print-on-one-line 0
  250. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  251. % 'additional-line' enlarges readability [1]
  252. % ----------------------------------------------------------------------
  253. % When printing call chains an empty line is printed between to
  254. % call points. Set 'additional-line' to 0 to disable this feature.
  255. %set additional-line 1
  256. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  257. % 'statistics' enables more accurate profiling [0]
  258. % ----------------------------------------------------------------------
  259. % Calculate number of allocations and deallocations and bytes also on
  260. % a per call chain basis. This uses 4 additional pointers for each
  261. % call chain.
  262. set statistics 1
  263. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  264. % set order for sorting of call chains [1] [1]
  265. % ----------------------------------------------------------------------
  266. % When printing the report to the log file the call chains are sorted by
  267. % default with respect to the largest accumulated garbage produced by
  268. % that call chain. This can be changed with setting 'sort-by-wasted'
  269. % to 0. In this case they are sorted by the number of allocated bytes.
  270. % If you want the number of allocations (only possible if 'statistics'
  271. % is enabled) as sorting criteria instead then set 'sort-by-size' to 0.
  272. %set sort-by-wasted 1
  273. %set sort-by-size 1
  274. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  275. % report library chains [0]
  276. % ----------------------------------------------------------------------
  277. % Some external libraries (like libg++) have memory leaks. On some
  278. % systems even a call to printf produces a leak. ccmalloc tries to
  279. % detect this (only heuristically!) and with this flag you can control
  280. % if leaks produced by such library calls are reported.
  281. %
  282. % Since version 0.2.1 some similar effect can be achieved by using
  283. % 'dont-log-chain' with no argument.
  284. %set library-chains 0
  285. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  286. % print debugging information [X] (compile time dependend)
  287. % ----------------------------------------------------------------------
  288. %set debug X
  289. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  290. % align memory on 8 byte boundary [0] (no effect on SunOS or Solaris)
  291. % ----------------------------------------------------------------------
  292. %set align-8-byte 0
  293. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  294. % only report allocations which ended up being wasted (i.e don't report
  295. % allocations which were completely freed properly. ) [1]
  296. % ----------------------------------------------------------------------
  297. %set only-wasting-alloc 1