blob: 04491db6bc463be31af9bebf0a1742e51ff41e55 [file] [log] [blame]
njn3e986b22004-11-30 10:43:45 +00001<?xml version="1.0"?> <!-- -*- sgml -*- -->
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
4[ <!ENTITY % vg-entities SYSTEM "vg-entities.xml"> %vg-entities; ]>
5
de252c6142005-11-27 04:10:00 +00006
njn3e986b22004-11-30 10:43:45 +00007<book id="FAQ" xreflabel="Valgrind FAQ">
de53ad6842005-11-19 03:28:10 +00008
dee9b715c2005-08-03 20:28:33 +00009<bookinfo>
de53ad6842005-11-19 03:28:10 +000010 <title>Valgrind FAQ</title>
de53ad6842005-11-19 03:28:10 +000011 <releaseinfo>&rel-type; &rel-version; &rel-date;</releaseinfo>
de9bec93c2005-11-25 05:36:48 +000012 <copyright>
13 <year>&vg-lifespan;</year>
14 <holder><ulink url="&vg-developers;">Valgrind Developers</ulink></holder>
15 </copyright>
debad57fc2005-12-03 22:33:29 +000016 <legalnotice>
17 <para>Email: <ulink url="mailto:&vg-vemail;">&vg-vemail;</ulink></para>
18 </legalnotice>
dee9b715c2005-08-03 20:28:33 +000019</bookinfo>
njn3e986b22004-11-30 10:43:45 +000020
de53ad6842005-11-19 03:28:10 +000021
de252c6142005-11-27 04:10:00 +000022<article id="faq">
de9bec93c2005-11-25 05:36:48 +000023<title>Valgrind Frequently Asked Questions</title>
24
25
26<!-- FAQ starts here -->
27<qandaset>
28
29
30<!-- Background -->
31<qandadiv id="faq.background" xreflabel="Background">
njn3e986b22004-11-30 10:43:45 +000032<title>Background</title>
33
njn3e986b22004-11-30 10:43:45 +000034<qandaentry id="faq.pronounce">
de9bec93c2005-11-25 05:36:48 +000035 <question id="q-pronounce">
njn3e986b22004-11-30 10:43:45 +000036 <para>How do you pronounce "Valgrind"?</para>
37 </question>
de9bec93c2005-11-25 05:36:48 +000038 <answer id="a-pronounce">
debad57fc2005-12-03 22:33:29 +000039 <para>The "Val" as in the world "value". The "grind" is pronounced
40 with a short 'i' -- ie. "grinned" (rhymes with "tinned") rather than
41 "grined" (rhymes with "find").</para> <para>Don't feel bad: almost
42 everyone gets it wrong at first.</para>
njn3e986b22004-11-30 10:43:45 +000043 </answer>
44</qandaentry>
45
46<qandaentry id="faq.whence">
de9bec93c2005-11-25 05:36:48 +000047 <question id="q-whence">
njn3e986b22004-11-30 10:43:45 +000048 <para>Where does the name "Valgrind" come from?</para>
49 </question>
de9bec93c2005-11-25 05:36:48 +000050 <answer id="a-whence">
debad57fc2005-12-03 22:33:29 +000051
52 <para>From Nordic mythology. Originally (before release) the project
53 was named Heimdall, after the watchman of the Nordic gods. He could
54 "see a hundred miles by day or night, hear the grass growing, see the
55 wool growing on a sheep's back" (etc). This would have been a great
56 name, but it was already taken by a security package "Heimdal".</para>
57
58 <para>Keeping with the Nordic theme, Valgrind was chosen. Valgrind is
59 the name of the main entrance to Valhalla (the Hall of the Chosen
60 Slain in Asgard). Over this entrance there resides a wolf and over it
61 there is the head of a boar and on it perches a huge eagle, whose eyes
62 can see to the far regions of the nine worlds. Only those judged
63 worthy by the guardians are allowed to pass through Valgrind. All
64 others are refused entrance.</para>
65
66 <para>It's not short for "value grinder", although that's not a bad
67 guess.</para>
njn3e986b22004-11-30 10:43:45 +000068 </answer>
69 </qandaentry>
70
de9bec93c2005-11-25 05:36:48 +000071</qandadiv>
njn3e986b22004-11-30 10:43:45 +000072
73
de9bec93c2005-11-25 05:36:48 +000074
75<!-- Compiling, Installing and Configuring -->
76<qandadiv id="faq.installing" xreflabel="Compiling, installing and configuring">
njn3e986b22004-11-30 10:43:45 +000077<title>Compiling, installing and configuring</title>
njn3e986b22004-11-30 10:43:45 +000078
79<qandaentry id="faq.make_dies">
de9bec93c2005-11-25 05:36:48 +000080 <question id="q-make_dies">
njn3e986b22004-11-30 10:43:45 +000081 <para>When I trying building Valgrind, 'make' dies partway with
de9bec93c2005-11-25 05:36:48 +000082 an assertion failure, something like this:</para>
njn3e986b22004-11-30 10:43:45 +000083<screen>
84% make: expand.c:489: allocated_variable_append:
85 Assertion 'current_variable_set_list->next != 0' failed.
86</screen>
njn3e986b22004-11-30 10:43:45 +000087 </question>
de9bec93c2005-11-25 05:36:48 +000088 <answer id="a-make_dies">
debad57fc2005-12-03 22:33:29 +000089 <para>It's probably a bug in 'make'. Some, but not all, instances of
90 version 3.79.1 have this bug, see
91 www.mail-archive.com/bug-make@gnu.org/msg01658.html. Try upgrading to
92 a more recent version of 'make'. Alternatively, we have heard that
93 unsetting the CFLAGS environment variable avoids the problem.</para>
njn3e986b22004-11-30 10:43:45 +000094 </answer>
95</qandaentry>
96
de9bec93c2005-11-25 05:36:48 +000097</qandadiv>
njn3e986b22004-11-30 10:43:45 +000098
99
100
de9bec93c2005-11-25 05:36:48 +0000101<!-- Valgrind aborts unexpectedly -->
102<qandadiv id="faq.abort" xreflabel="Valgrind aborts unexpectedly">
njn3e986b22004-11-30 10:43:45 +0000103<title>Valgrind aborts unexpectedly</title>
njn3e986b22004-11-30 10:43:45 +0000104
105<qandaentry id="faq.exit_errors">
debad57fc2005-12-03 22:33:29 +0000106 <question id="q-exit_errors">
107 <para>Programs run OK on Valgrind, but at exit produce a bunch of
108 errors involving <literal>__libc_freeres()</literal> and then die
109 with a segmentation fault.</para>
110 </question>
111 <answer id="a-exit_errors">
112 <para>When the program exits, Valgrind runs the procedure
113 <function>__libc_freeres()</function> in glibc. This is a hook for
114 memory debuggers, so they can ask glibc to free up any memory it has
115 used. Doing that is needed to ensure that Valgrind doesn't
116 incorrectly report space leaks in glibc.</para>
117
118 <para>Problem is that running <literal>__libc_freeres()</literal> in
119 older glibc versions causes this crash.</para>
120
121 <para>WORKAROUND FOR 1.1.X and later versions of Valgrind: use the
122 <option>--run-libc-freeres=no</option> flag. You may then get space
123 leak reports for glibc-allocations (please _don't_ report these to
124 the glibc people, since they are not real leaks), but at least the
125 program runs.</para>
126 </answer>
njn3e986b22004-11-30 10:43:45 +0000127</qandaentry>
128
129<qandaentry id="faq.bugdeath">
debad57fc2005-12-03 22:33:29 +0000130 <question id="q-bugdeath">
131 <para>My (buggy) program dies like this:</para>
de9bec93c2005-11-25 05:36:48 +0000132<screen>% valgrind: vg_malloc2.c:442 (bszW_to_pszW): Assertion 'pszW >= 0' failed.</screen>
debad57fc2005-12-03 22:33:29 +0000133 </question>
134 <answer id="a-bugdeath">
135 <para>If Memcheck (the memory checker) shows any invalid reads,
136 invalid writes and invalid frees in your program, the above may
137 happen. Reason is that your program may trash Valgrind's low-level
138 memory manager, which then dies with the above assertion, or
139 something like this. The cure is to fix your program so that it
140 doesn't do any illegal memory accesses. The above failure will
141 hopefully go away after that.</para>
142 </answer>
njn3e986b22004-11-30 10:43:45 +0000143</qandaentry>
144
145<qandaentry id="faq.msgdeath">
debad57fc2005-12-03 22:33:29 +0000146 <question id="q-msgdeath">
147 <para>My program dies, printing a message like this along the
njn3e986b22004-11-30 10:43:45 +0000148 way:</para>
de9bec93c2005-11-25 05:36:48 +0000149<screen>% disInstr: unhandled instruction bytes: 0x66 0xF 0x2E 0x5</screen>
debad57fc2005-12-03 22:33:29 +0000150 </question>
151 <answer id="a-msgdeath">
152 <para>Older versions did not support some x86 instructions,
153 particularly SSE/SSE2 instructions. Try a newer Valgrind; we now
154 support almost all instructions. If it still happens with newer
155 versions, if the failing instruction is an SSE/SSE2 instruction, you
156 might be able to recompile your program without it by using the flag
157 <option>-march</option> to gcc. Either way, let us know and we'll
158 try to fix it.</para>
njn3e986b22004-11-30 10:43:45 +0000159
debad57fc2005-12-03 22:33:29 +0000160 <para>Another possibility is that your program has a bug and
161 erroneously jumps to a non-code address, in which case you'll get a
njn1d0825f2006-03-27 11:37:07 +0000162 SIGILL signal. Memcheck may issue a warning just before
debad57fc2005-12-03 22:33:29 +0000163 this happens, but they might not if the jump happens to land in
164 addressable memory.</para>
165 </answer>
njn3e986b22004-11-30 10:43:45 +0000166</qandaentry>
167
njndde37b42005-10-06 18:58:33 +0000168<qandaentry id="faq.java">
debad57fc2005-12-03 22:33:29 +0000169 <question id="q-java">
170 <para>I tried running a Java program (or another program that uses a
171 just-in-time compiler) under Valgrind but something went wrong.
172 Does Valgrind handle such programs?</para>
173 </question>
174 <answer id="a-java">
175 <para>Valgrind can handle dynamically generated code, so long as
176 none of the generated code is later overwritten by other generated
177 code. If this happens, though, things will go wrong as Valgrind
178 will continue running its translations of the old code (this is true
179 on x86 and AMD64, on PPC32 there are explicit cache flush
180 instructions which Valgrind detects). You should try running with
181 <option>--smc-check=all</option> in this case; Valgrind will run
182 much more slowly, but should detect the use of the out-of-date
183 code.</para>
184
185 <para>Alternativaly, if you have the source code to the JIT compiler
186 you can insert calls to the
187 <computeroutput>VALGRIND_DISCARD_TRANSLATIONS</computeroutput>
188 client request to mark out-of-date code, saving you from using
189 <option>--smc-check=all</option>.</para>
190
191 <para>Apart from this, in theory Valgrind can run any Java program
192 just fine, even those that use JNI and are partially implemented in
193 other languages like C and C++. In practice, Java implementations
194 tend to do nasty things that most programs do not, and Valgrind
195 sometimes falls over these corner cases.</para>
196
197 <para>If your Java programs do not run under Valgrind, even with
198 <option>--smc-check=all</option>, please file a bug report and
199 hopefully we'll be able to fix the problem.</para>
200 </answer>
njndde37b42005-10-06 18:58:33 +0000201</qandaentry>
202
de9bec93c2005-11-25 05:36:48 +0000203</qandadiv>
njn3e986b22004-11-30 10:43:45 +0000204
205
de9bec93c2005-11-25 05:36:48 +0000206<!-- Valgrind behaves unexpectedly -->
207<qandadiv id="faq.unexpected" xreflabel="Valgrind behaves unexpectedly">
njn3e986b22004-11-30 10:43:45 +0000208<title>Valgrind behaves unexpectedly</title>
njn3e986b22004-11-30 10:43:45 +0000209
njn3e986b22004-11-30 10:43:45 +0000210<qandaentry id="faq.reports">
debad57fc2005-12-03 22:33:29 +0000211 <question id="q-reports">
212 <para>My program uses the C++ STL and string classes. Valgrind
213 reports 'still reachable' memory leaks involving these classes at
214 the exit of the program, but there should be none.</para>
215 </question>
216 <answer id="a-reports">
217 <para>First of all: relax, it's probably not a bug, but a feature.
218 Many implementations of the C++ standard libraries use their own
219 memory pool allocators. Memory for quite a number of destructed
220 objects is not immediately freed and given back to the OS, but kept
221 in the pool(s) for later re-use. The fact that the pools are not
222 freed at the exit() of the program cause Valgrind to report this
223 memory as still reachable. The behaviour not to free pools at the
224 exit() could be called a bug of the library though.</para>
njn3e986b22004-11-30 10:43:45 +0000225
debad57fc2005-12-03 22:33:29 +0000226 <para>Using gcc, you can force the STL to use malloc and to free
227 memory as soon as possible by globally disabling memory caching.
228 Beware! Doing so will probably slow down your program, sometimes
229 drastically.</para>
230 <itemizedlist>
231 <listitem>
232 <para>With gcc 2.91, 2.95, 3.0 and 3.1, compile all source using
233 the STL with <literal>-D__USE_MALLOC</literal>. Beware! This is
234 removed from gcc starting with version 3.3.</para>
235 </listitem>
236 <listitem>
237 <para>With gcc 3.2.2 and later, you should export the
238 environment variable <literal>GLIBCPP_FORCE_NEW</literal> before
239 running your program.</para>
240 </listitem>
241 <listitem>
242 <para>With gcc 3.4 and later, that variable has changed name to
243 <literal>GLIBCXX_FORCE_NEW</literal>.</para>
244 </listitem>
245 </itemizedlist>
njn3e986b22004-11-30 10:43:45 +0000246
debad57fc2005-12-03 22:33:29 +0000247 <para>There are other ways to disable memory pooling: using the
248 <literal>malloc_alloc</literal> template with your objects (not
249 portable, but should work for gcc) or even writing your own memory
250 allocators. But all this goes beyond the scope of this FAQ. Start
251 by reading
252 <ulink url="http://gcc.gnu.org/onlinedocs/libstdc++/ext/howto.html#3">
253 http://gcc.gnu.org/onlinedocs/libstdc++/ext/howto.html#3</ulink> if
254 you absolutely want to do that. But beware:</para>
njn3e986b22004-11-30 10:43:45 +0000255
debad57fc2005-12-03 22:33:29 +0000256 <orderedlist>
257 <listitem>
258 <para>there are currently changes underway for gcc which are not
259 totally reflected in the docs right now ("now" == 26 Apr 03)</para>
260 </listitem>
261 <listitem>
262 <para>allocators belong to the more messy parts of the STL and
263 people went to great lengths to make it portable across
264 platforms. Chances are good that your solution will work on your
265 platform, but not on others.</para>
266 </listitem>
267 </orderedlist>
njn3e986b22004-11-30 10:43:45 +0000268 </answer>
269</qandaentry>
270
271
272<qandaentry id="faq.unhelpful">
debad57fc2005-12-03 22:33:29 +0000273 <question id="q-unhelpful">
274 <para>The stack traces given by Memcheck (or another tool) aren't
275 helpful. How can I improve them?</para>
276 </question>
277 <answer id="a-unhelpful">
278 <para>If they're not long enough, use <option>--num-callers</option>
279 to make them longer.</para>
njn3e986b22004-11-30 10:43:45 +0000280
debad57fc2005-12-03 22:33:29 +0000281 <para>If they're not detailed enough, make sure you are compiling
282 with <option>-g</option> to add debug information. And don't strip
283 symbol tables (programs should be unstripped unless you run 'strip'
284 on them; some libraries ship stripped).</para>
njn0211ff32005-05-15 14:49:24 +0000285
debad57fc2005-12-03 22:33:29 +0000286 <para>Also, for leak reports involving shared objects, if the shared
287 object is unloaded before the program terminates, Valgrind will
288 discard the debug information and the error message will be full of
289 <literal>???</literal> entries. The workaround here is to avoid
290 calling dlclose() on these shared objects.</para>
291
292 <para>Also, <option>-fomit-frame-pointer</option> and
293 <option>-fstack-check</option> can make stack traces worse.</para>
njn3e986b22004-11-30 10:43:45 +0000294
295 <para>Some example sub-traces:</para>
296
njn15d7c342005-09-30 01:43:32 +0000297 <itemizedlist>
298 <listitem>
299 <para>With debug information and unstripped (best):</para>
njn3e986b22004-11-30 10:43:45 +0000300<programlisting>
301Invalid write of size 1
302 at 0x80483BF: really (malloc1.c:20)
303 by 0x8048370: main (malloc1.c:9)
304</programlisting>
njn15d7c342005-09-30 01:43:32 +0000305 </listitem>
njn3e986b22004-11-30 10:43:45 +0000306
njn15d7c342005-09-30 01:43:32 +0000307 <listitem>
308 <para>With no debug information, unstripped:</para>
njn3e986b22004-11-30 10:43:45 +0000309<programlisting>
310Invalid write of size 1
311 at 0x80483BF: really (in /auto/homes/njn25/grind/head5/a.out)
312 by 0x8048370: main (in /auto/homes/njn25/grind/head5/a.out)
313</programlisting>
njn15d7c342005-09-30 01:43:32 +0000314 </listitem>
njn3e986b22004-11-30 10:43:45 +0000315
njn15d7c342005-09-30 01:43:32 +0000316 <listitem>
317 <para>With no debug information, stripped:</para>
njn3e986b22004-11-30 10:43:45 +0000318<programlisting>
319Invalid write of size 1
320 at 0x80483BF: (within /auto/homes/njn25/grind/head5/a.out)
321 by 0x8048370: (within /auto/homes/njn25/grind/head5/a.out)
322 by 0x42015703: __libc_start_main (in /lib/tls/libc-2.3.2.so)
323 by 0x80482CC: (within /auto/homes/njn25/grind/head5/a.out)
324</programlisting>
njn15d7c342005-09-30 01:43:32 +0000325 </listitem>
njn3e986b22004-11-30 10:43:45 +0000326
njn15d7c342005-09-30 01:43:32 +0000327 <listitem>
328 <para>With debug information and -fomit-frame-pointer:</para>
njn3e986b22004-11-30 10:43:45 +0000329<programlisting>
330Invalid write of size 1
331 at 0x80483C4: really (malloc1.c:20)
332 by 0x42015703: __libc_start_main (in /lib/tls/libc-2.3.2.so)
333 by 0x80482CC: ??? (start.S:81)
334</programlisting>
njn15d7c342005-09-30 01:43:32 +0000335 </listitem>
njn3e986b22004-11-30 10:43:45 +0000336
njn15d7c342005-09-30 01:43:32 +0000337 <listitem>
338 <para>A leak error message involving an unloaded shared object:</para>
njn0211ff32005-05-15 14:49:24 +0000339<programlisting>
34084 bytes in 1 blocks are possibly lost in loss record 488 of 713
341 at 0x1B9036DA: operator new(unsigned) (vg_replace_malloc.c:132)
342 by 0x1DB63EEB: ???
343 by 0x1DB4B800: ???
344 by 0x1D65E007: ???
345 by 0x8049EE6: main (main.cpp:24)
346</programlisting>
njn15d7c342005-09-30 01:43:32 +0000347 </listitem>
348 </itemizedlist>
njn0211ff32005-05-15 14:49:24 +0000349
njn3e986b22004-11-30 10:43:45 +0000350 </answer>
351</qandaentry>
352
njn16eeb4e2005-06-16 03:56:58 +0000353<qandaentry id="faq.aliases">
debad57fc2005-12-03 22:33:29 +0000354 <question id="q-aliases">
355 <para>The stack traces given by Memcheck (or another tool) seem to
356 have the wrong function name in them. What's happening?</para>
357 </question>
358 <answer id="a-aliases">
359 <para>Occasionally Valgrind stack traces get the wrong function
360 names. This is caused by glibc using aliases to effectively give
361 one function two names. Most of the time Valgrind chooses a
362 suitable name, but very occasionally it gets it wrong. Examples we
363 know of are printing 'bcmp' instead of 'memcmp', 'index' instead of
364 'strchr', and 'rindex' instead of 'strrchr'.</para>
365 </answer>
njn16eeb4e2005-06-16 03:56:58 +0000366</qandaentry>
367
de9bec93c2005-11-25 05:36:48 +0000368</qandadiv>
njn3e986b22004-11-30 10:43:45 +0000369
370
de9bec93c2005-11-25 05:36:48 +0000371
372<!-- Memcheck doesn't find my bug -->
373<qandadiv id="faq.notfound" xreflabel="Memcheck doesn't find my bug">
njn3e986b22004-11-30 10:43:45 +0000374<title>Memcheck doesn't find my bug</title>
njn3e986b22004-11-30 10:43:45 +0000375
376<qandaentry id="faq.hiddenbug">
debad57fc2005-12-03 22:33:29 +0000377 <question id="q-hiddenbug">
378 <para>I try running "valgrind --tool=memcheck my_program" and get
379 Valgrind's startup message, but I don't get any errors and I know my
380 program has errors.</para>
381 </question>
382 <answer id="a-hiddenbug">
383 <para>There are two possible causes of this.</para>
njna11b9b02005-03-27 17:05:08 +0000384
debad57fc2005-12-03 22:33:29 +0000385 <para>First, by default, Valgrind only traces the top-level process.
386 So if your program spawns children, they won't be traced by Valgrind
387 by default. Also, if your program is started by a shell script,
388 Perl script, or something similar, Valgrind will trace the shell, or
389 the Perl interpreter, or equivalent.</para>
njn3e986b22004-11-30 10:43:45 +0000390
debad57fc2005-12-03 22:33:29 +0000391 <para>To trace child processes, use the
392 <option>--trace-children=yes</option> option.</para>
njn3e986b22004-11-30 10:43:45 +0000393
debad57fc2005-12-03 22:33:29 +0000394 <para>If you are tracing large trees of processes, it can be less
395 disruptive to have the output sent over the network. Give Valgrind
396 the flag <option>--log-socket=127.0.0.1:12345</option> (if you want
397 logging output sent to <literal>port 12345</literal> on
398 <literal>localhost</literal>). You can use the valgrind-listener
399 program to listen on that port:</para>
njn3e986b22004-11-30 10:43:45 +0000400<programlisting>
401valgrind-listener 12345
402</programlisting>
403
debad57fc2005-12-03 22:33:29 +0000404 <para>Obviously you have to start the listener process first. See
405 the manual for more details.</para>
njna11b9b02005-03-27 17:05:08 +0000406
debad57fc2005-12-03 22:33:29 +0000407 <para>Second, if your program is statically linked, most Valgrind
408 tools won't work as well, because they won't be able to replace
409 certain functions, such as malloc(), with their own versions. A key
410 indicator of this is if Memcheck says:
njna11b9b02005-03-27 17:05:08 +0000411<programlisting>
njn5666ee62005-12-19 19:38:02 +0000412All heap blocks were freed -- no leaks are possible
njna11b9b02005-03-27 17:05:08 +0000413</programlisting>
debad57fc2005-12-03 22:33:29 +0000414 when you know your program calls malloc(). The workaround is to
415 avoid statically linking your program.</para>
416 </answer>
njn3e986b22004-11-30 10:43:45 +0000417</qandaentry>
418
419
420<qandaentry id="faq.overruns">
debad57fc2005-12-03 22:33:29 +0000421 <question id="q-overruns">
422 <para>Why doesn't Memcheck find the array overruns in this
423 program?</para>
njn3e986b22004-11-30 10:43:45 +0000424<programlisting>
425int static[5];
426
427int main(void)
428{
429 int stack[5];
430
431 static[5] = 0;
432 stack [5] = 0;
433
434 return 0;
435}
436</programlisting>
debad57fc2005-12-03 22:33:29 +0000437 </question>
438 <answer id="a-overruns">
439 <para>Unfortunately, Memcheck doesn't do bounds checking on static
440 or stack arrays. We'd like to, but it's just not possible to do in
441 a reasonable way that fits with how Memcheck works. Sorry.</para>
442 </answer>
njn3e986b22004-11-30 10:43:45 +0000443</qandaentry>
444
de9bec93c2005-11-25 05:36:48 +0000445</qandadiv>
njn3e986b22004-11-30 10:43:45 +0000446
447
de9bec93c2005-11-25 05:36:48 +0000448
449<!-- Miscellaneous -->
450<qandadiv id="faq.misc" xreflabel="Miscellaneous">
njn3e986b22004-11-30 10:43:45 +0000451<title>Miscellaneous</title>
njn3e986b22004-11-30 10:43:45 +0000452
453<qandaentry id="faq.writesupp">
debad57fc2005-12-03 22:33:29 +0000454 <question id="q-writesupp">
455 <para>I tried writing a suppression but it didn't work. Can you
456 write my suppression for me?</para>
457 </question>
458 <answer id="a-writesupp">
459 <para>Yes! Use the <option>--gen-suppressions=yes</option> feature
460 to spit out suppressions automatically for you. You can then edit
461 them if you like, eg. combining similar automatically generated
462 suppressions using wildcards like <literal>'*'</literal>.</para>
njn3e986b22004-11-30 10:43:45 +0000463
debad57fc2005-12-03 22:33:29 +0000464 <para>If you really want to write suppressions by hand, read the
465 manual carefully. Note particularly that C++ function names must be
466 <literal>_mangled_</literal>.</para>
467 </answer>
njn3e986b22004-11-30 10:43:45 +0000468</qandaentry>
469
470
471<qandaentry id="faq.deflost">
debad57fc2005-12-03 22:33:29 +0000472 <question id="q-deflost">
njn1d0825f2006-03-27 11:37:07 +0000473 <para>With Memcheck's memory leak detector, what's the
debad57fc2005-12-03 22:33:29 +0000474 difference between "definitely lost", "possibly lost", "still
475 reachable", and "suppressed"?</para>
476 </question>
477 <answer id="a-deflost">
478 <para>The details are in the Memcheck section of the user
479 manual.</para>
njn3e986b22004-11-30 10:43:45 +0000480
debad57fc2005-12-03 22:33:29 +0000481 <para>In short:</para>
482 <itemizedlist>
483 <listitem>
484 <para>"definitely lost" means your program is leaking memory --
485 fix it!</para>
486 </listitem>
487 <listitem>
488 <para>"possibly lost" means your program is probably leaking
489 memory, unless you're doing funny things with pointers.</para>
490 </listitem>
491 <listitem>
492 <para>"still reachable" means your program is probably ok -- it
493 didn't free some memory it could have. This is quite common and
494 often reasonable. Don't use
495 <option>--show-reachable=yes</option> if you don't want to see
496 these reports.</para>
497 </listitem>
498 <listitem>
499 <para>"suppressed" means that a leak error has been suppressed.
500 There are some suppressions in the default suppression files.
501 You can ignore suppressed errors.</para>
502 </listitem>
503 </itemizedlist>
504 </answer>
njn3e986b22004-11-30 10:43:45 +0000505</qandaentry>
506
de9bec93c2005-11-25 05:36:48 +0000507</qandadiv>
njn3e986b22004-11-30 10:43:45 +0000508
de9bec93c2005-11-25 05:36:48 +0000509
510
511<!-- Further Assistance -->
512<qandadiv id="faq.help" xreflabel="How To Get Further Assistance">
513<title>How To Get Further Assistance</title>
514
515<qandaentry id="e-help">
debad57fc2005-12-03 22:33:29 +0000516 <!-- <question><para/></question> -->
517 <answer id="a-help">
de9bec93c2005-11-25 05:36:48 +0000518 <para>Please read all of this section before posting.</para>
519
520 <para>If you think an answer is incomplete or inaccurate, please
521 e-mail <ulink url="mailto:&vg-vemail;">&vg-vemail;</ulink>.</para>
debad57fc2005-12-03 22:33:29 +0000522
de97ab7e72005-11-27 18:19:40 +0000523 <para>Read the appropriate section(s) of the
524 <ulink url="&vg-bookset;">Valgrind Documentation</ulink>.</para>
de9bec93c2005-11-25 05:36:48 +0000525
de97ab7e72005-11-27 18:19:40 +0000526 <para>Read the
527 <ulink url="&vg-dist-docs;">Distribution Documents</ulink>.</para>
de9bec93c2005-11-25 05:36:48 +0000528
529 <para><ulink url="http://search.gmane.org">Search</ulink> the
530 <ulink url="http://news.gmane.org/gmane.comp.debugging.valgrind">valgrind-users</ulink> mailing list archives, using the group name
531 <computeroutput>gmane.comp.debugging.valgrind</computeroutput>.</para>
532
debad57fc2005-12-03 22:33:29 +0000533 <para>Only when you have tried all of these things and are still
534 stuck, should you post to the
535 <ulink url="&vg-users-list;">valgrind-users mailing list</ulink>. In
536 which case, please read the following carefully. Making a complete
537 posting will greatly increase the chances that an expert or fellow
538 user reading it will have enough information and motivation to
539 reply.</para>
de9bec93c2005-11-25 05:36:48 +0000540
debad57fc2005-12-03 22:33:29 +0000541 <para>Make sure you give full details of the problem, including the
njn1ac2f0d2005-12-04 19:26:00 +0000542 full output of <computeroutput>valgrind -v &lt;your-prog&gt;</computeroutput>, if
debad57fc2005-12-03 22:33:29 +0000543 applicable. Also which Linux distribution you're using (Red Hat,
544 Debian, etc) and its version number.</para>
de9bec93c2005-11-25 05:36:48 +0000545
debad57fc2005-12-03 22:33:29 +0000546 <para>You are in little danger of making your posting too long unless
547 you include large chunks of Valgrind's (unsuppressed) output, so err
548 on the side of giving too much information.</para>
de9bec93c2005-11-25 05:36:48 +0000549
debad57fc2005-12-03 22:33:29 +0000550 <para>Clearly written subject lines and message bodies are
551 appreciated, too.</para>
de9bec93c2005-11-25 05:36:48 +0000552
553 <para>Finally, remember that, despite the fact that most of the
debad57fc2005-12-03 22:33:29 +0000554 community are very helpful and responsive to emailed questions, you
555 are probably requesting help from unpaid volunteers, so you have no
556 guarantee of receiving an answer.</para>
de9bec93c2005-11-25 05:36:48 +0000557</answer>
558
559</qandaentry>
560</qandadiv>
561
562
563<!-- FAQ ends here -->
njn3e986b22004-11-30 10:43:45 +0000564</qandaset>
de9bec93c2005-11-25 05:36:48 +0000565
njn3e986b22004-11-30 10:43:45 +0000566
567
568<!-- template
de9bec93c2005-11-25 05:36:48 +0000569<qandadiv id="faq.installing" xreflabel="Installing">
570<title>Installing</title>
njn3e986b22004-11-30 10:43:45 +0000571
de9bec93c2005-11-25 05:36:48 +0000572<qandaentry id="faq.problem">
573 <question id="q-problem">
njn3e986b22004-11-30 10:43:45 +0000574 <para></para>
575 </question>
de9bec93c2005-11-25 05:36:48 +0000576 <answer id="a-problem">
njn3e986b22004-11-30 10:43:45 +0000577 <para></para>
578 </answer>
579</qandaentry>
580
de9bec93c2005-11-25 05:36:48 +0000581</qandadiv>
njn3e986b22004-11-30 10:43:45 +0000582-->
583
de9bec93c2005-11-25 05:36:48 +0000584</article>
njn3e986b22004-11-30 10:43:45 +0000585
586</book>