blob: 66ff21c0aba9db0a04e8ff573c1eca6445f23c3b [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>
16 <author>
17 <email><ulink url="mailto:&vg-vemail;">&vg-vemail;</ulink></email>
18 </author>
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">
njn3e986b22004-11-30 10:43:45 +000039 <para>The "Val" as in the world "value". The "grind" is
40 pronounced with a short 'i' -- ie. "grinned" (rhymes with
41 "tinned") rather than "grined" (rhymes with "find").</para>
42 <para>Don't feel bad: almost everyone gets it wrong at
43 first.</para>
44 </answer>
45</qandaentry>
46
47<qandaentry id="faq.whence">
de9bec93c2005-11-25 05:36:48 +000048 <question id="q-whence">
njn3e986b22004-11-30 10:43:45 +000049 <para>Where does the name "Valgrind" come from?</para>
50 </question>
de9bec93c2005-11-25 05:36:48 +000051 <answer id="a-whence">
njn3e986b22004-11-30 10:43:45 +000052 <para>From Nordic mythology. Originally (before release) the
53 project was named Heimdall, after the watchman of the Nordic
54 gods. He could "see a hundred miles by day or night, hear the
55 grass growing, see the wool growing on a sheep's back" (etc).
56 This would have been a great name, but it was already taken by
57 a security package "Heimdal".</para> <para>Keeping with the
58 Nordic theme, Valgrind was chosen. Valgrind is the name of the
59 main entrance to Valhalla (the Hall of the Chosen Slain in
60 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,
62 whose eyes can see to the far regions of the nine worlds. Only
63 those judged worthy by the guardians are allowed to pass
64 through Valgrind. All others are refused entrance.</para>
65 <para>It's not short for "value grinder", although that's not a
66 bad guess.</para>
67 </answer>
68 </qandaentry>
69
de9bec93c2005-11-25 05:36:48 +000070</qandadiv>
njn3e986b22004-11-30 10:43:45 +000071
72
de9bec93c2005-11-25 05:36:48 +000073
74<!-- Compiling, Installing and Configuring -->
75<qandadiv id="faq.installing" xreflabel="Compiling, installing and configuring">
njn3e986b22004-11-30 10:43:45 +000076<title>Compiling, installing and configuring</title>
njn3e986b22004-11-30 10:43:45 +000077
78<qandaentry id="faq.make_dies">
de9bec93c2005-11-25 05:36:48 +000079 <question id="q-make_dies">
njn3e986b22004-11-30 10:43:45 +000080 <para>When I trying building Valgrind, 'make' dies partway with
de9bec93c2005-11-25 05:36:48 +000081 an assertion failure, something like this:</para>
njn3e986b22004-11-30 10:43:45 +000082<screen>
83% make: expand.c:489: allocated_variable_append:
84 Assertion 'current_variable_set_list->next != 0' failed.
85</screen>
njn3e986b22004-11-30 10:43:45 +000086 </question>
de9bec93c2005-11-25 05:36:48 +000087 <answer id="a-make_dies">
njn3e986b22004-11-30 10:43:45 +000088 <para>It's probably a bug in 'make'. Some, but not all,
89 instances of version 3.79.1 have this bug, see
90 www.mail-archive.com/bug-make@gnu.org/msg01658.html. Try
91 upgrading to a more recent version of 'make'. Alternatively,
92 we have heard that unsetting the CFLAGS environment variable
93 avoids the problem.</para>
94 </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">
de9bec93c2005-11-25 05:36:48 +0000106 <question id="q-exit_errors">
njn3e986b22004-11-30 10:43:45 +0000107 <para>Programs run OK on Valgrind, but at exit produce a bunch
sewardj8d9fec52005-11-15 20:56:23 +0000108 of errors involving <literal>__libc_freeres()</literal>
109 and then die with a segmentation fault.</para>
njn04be8752005-08-26 21:01:32 +0000110 </question>
de9bec93c2005-11-25 05:36:48 +0000111 <answer id="a-exit_errors">
112 <para>When the program exits, Valgrind runs the procedure
113 <literal>__libc_freeres()</literal> in glibc. This is a hook
114 for memory debuggers, so they can ask glibc to free up any
115 memory it has used. Doing that is needed to ensure that
116 Valgrind doesn't incorrectly report space leaks in glibc.</para>
117 <para>Problem is that running
118 <literal>__libc_freeres()</literal> in older glibc versions
119 causes this crash.</para> <para>WORKAROUND FOR 1.1.X and later
120 versions of Valgrind: use the
121 <literal>--run-libc-freeres=no</literal> flag. You may then get
122 space leak reports for glibc-allocations (please _don't_ report
123 these to the glibc people, since they are not real leaks), but
124 at least the program runs.</para>
njn3e986b22004-11-30 10:43:45 +0000125 </answer>
126</qandaentry>
127
128<qandaentry id="faq.bugdeath">
de9bec93c2005-11-25 05:36:48 +0000129 <question id="q-bugdeath">
njn3e986b22004-11-30 10:43:45 +0000130 <para>My (buggy) program dies like this:</para>
de9bec93c2005-11-25 05:36:48 +0000131<screen>% valgrind: vg_malloc2.c:442 (bszW_to_pszW): Assertion 'pszW >= 0' failed.</screen>
njn04be8752005-08-26 21:01:32 +0000132 </question>
de9bec93c2005-11-25 05:36:48 +0000133 <answer id="a-bugdeath">
njn3e986b22004-11-30 10:43:45 +0000134 <para>If Memcheck (the memory checker) shows any invalid reads,
135 invalid writes and invalid frees in your program, the above may
136 happen. Reason is that your program may trash Valgrind's
137 low-level memory manager, which then dies with the above
138 assertion, or something like this. The cure is to fix your
139 program so that it doesn't do any illegal memory accesses. The
140 above failure will hopefully go away after that.</para>
141 </answer>
142</qandaentry>
143
144<qandaentry id="faq.msgdeath">
de9bec93c2005-11-25 05:36:48 +0000145 <question id="q-msgdeath">
njn3e986b22004-11-30 10:43:45 +0000146 <para>My program dies, printing a message like this along the
147 way:</para>
de9bec93c2005-11-25 05:36:48 +0000148<screen>% disInstr: unhandled instruction bytes: 0x66 0xF 0x2E 0x5</screen>
njn04be8752005-08-26 21:01:32 +0000149 </question>
de9bec93c2005-11-25 05:36:48 +0000150 <answer id="a-msgdeath">
njn3e986b22004-11-30 10:43:45 +0000151 <para>Older versions did not support some x86 instructions,
152 particularly SSE/SSE2 instructions. Try a newer Valgrind; we
153 now support almost all instructions. If it still happens with
154 newer versions, if the failing instruction is an SSE/SSE2
njnd0d64732005-04-16 14:58:34 +0000155 instruction, you might be able to recompile your program
njn3e986b22004-11-30 10:43:45 +0000156 without it by using the flag
157 <computeroutput>-march</computeroutput> to gcc. Either way,
158 let us know and we'll try to fix it.</para>
159
160 <para>Another possibility is that your program has a bug and
161 erroneously jumps to a non-code address, in which case you'll
162 get a SIGILL signal. Memcheck/Addrcheck may issue a warning
163 just before this happens, but they might not if the jump
164 happens to land in addressable memory.</para>
165 </answer>
166</qandaentry>
167
njndde37b42005-10-06 18:58:33 +0000168<qandaentry id="faq.java">
de9bec93c2005-11-25 05:36:48 +0000169 <question id="q-java">
njn89c79652005-10-06 19:30:40 +0000170 <para>I tried running a Java program (or another program that uses a
de9bec93c2005-11-25 05:36:48 +0000171 just-in-time compiler) under Valgrind but something went wrong.
172 Does Valgrind handle such programs?</para>
njndde37b42005-10-06 18:58:33 +0000173 </question>
de9bec93c2005-11-25 05:36:48 +0000174 <answer id="a-java">
njn89c79652005-10-06 19:30:40 +0000175 <para>Valgrind can handle dynamically generated code, so long as none
de9bec93c2005-11-25 05:36:48 +0000176 of the generated code is later overwritten by other generated code.
177 If this happens, though, things will go wrong as Valgrind will continue
178 running its translations of the old code (this is true on x86 and AMD64,
179 on PPC32 there are explicit cache flush instructions which Valgrind
180 detects). You should try running with
181 <computeroutput>--smc-check=all</computeroutput> in this case; Valgrind
182 will run much more slowly, but should detect the use of the out-of-date
183 code.</para>
njn89c79652005-10-06 19:30:40 +0000184 <para>Alternativaly, if you have the source code to the JIT compiler you
de9bec93c2005-11-25 05:36:48 +0000185 can insert calls to the
186 <computeroutput>VALGRIND_DISCARD_TRANSLATIONS</computeroutput> client
187 request to mark out-of-date code, saving you from using
188 <computeroutput>--smc-check=all</computeroutput>.</para>
njn89c79652005-10-06 19:30:40 +0000189 <para>Apart from this, in theory Valgrind can run any Java program just
de9bec93c2005-11-25 05:36:48 +0000190 fine, even those that use JNI and are partially implemented in other
191 languages like C and C++. In practice, Java implementations tend to do
192 nasty things that most programs do not, and Valgrind sometimes falls
193 over these corner cases.</para>
njn89c79652005-10-06 19:30:40 +0000194 <para>If your Java programs do not run under Valgrind, even with
de9bec93c2005-11-25 05:36:48 +0000195 <computeroutput>--smc-check=all</computeroutput>, please file a bug
196 report and hopefully we'll be able to fix the problem.</para>
njndde37b42005-10-06 18:58:33 +0000197 </answer>
198</qandaentry>
199
de9bec93c2005-11-25 05:36:48 +0000200</qandadiv>
njn3e986b22004-11-30 10:43:45 +0000201
202
de9bec93c2005-11-25 05:36:48 +0000203<!-- Valgrind behaves unexpectedly -->
204<qandadiv id="faq.unexpected" xreflabel="Valgrind behaves unexpectedly">
njn3e986b22004-11-30 10:43:45 +0000205<title>Valgrind behaves unexpectedly</title>
njn3e986b22004-11-30 10:43:45 +0000206
njn3e986b22004-11-30 10:43:45 +0000207<qandaentry id="faq.reports">
de9bec93c2005-11-25 05:36:48 +0000208 <question id="q-reports">
njn3e986b22004-11-30 10:43:45 +0000209 <para>My program uses the C++ STL and string classes. Valgrind
210 reports 'still reachable' memory leaks involving these classes
211 at the exit of the program, but there should be none.</para>
212 </question>
de9bec93c2005-11-25 05:36:48 +0000213 <answer id="a-reports">
njn3e986b22004-11-30 10:43:45 +0000214 <para>First of all: relax, it's probably not a bug, but a
215 feature. Many implementations of the C++ standard libraries
216 use their own memory pool allocators. Memory for quite a
217 number of destructed objects is not immediately freed and given
218 back to the OS, but kept in the pool(s) for later re-use. The
219 fact that the pools are not freed at the exit() of the program
220 cause Valgrind to report this memory as still reachable. The
221 behaviour not to free pools at the exit() could be called a bug
222 of the library though.</para>
223
224 <para>Using gcc, you can force the STL to use malloc and to
225 free memory as soon as possible by globally disabling memory
226 caching. Beware! Doing so will probably slow down your
227 program, sometimes drastically.</para>
228 <itemizedlist>
229 <listitem>
230 <para>With gcc 2.91, 2.95, 3.0 and 3.1, compile all source
231 using the STL with <literal>-D__USE_MALLOC</literal>. Beware!
232 This is removed from gcc starting with version 3.3.</para>
233 </listitem>
234 <listitem>
njn8a5ad762005-05-12 13:45:56 +0000235 <para>With gcc 3.2.2 and later, you should export the environment
njn3e986b22004-11-30 10:43:45 +0000236 variable <literal>GLIBCPP_FORCE_NEW</literal> before running
237 your program.</para>
238 </listitem>
njn8a5ad762005-05-12 13:45:56 +0000239 <listitem>
240 <para>With gcc 3.4 and later, that variable has changed name to
241 <literal>GLIBCXX_FORCE_NEW</literal>.</para>
242 </listitem>
njn3e986b22004-11-30 10:43:45 +0000243 </itemizedlist>
244
245 <para>There are other ways to disable memory pooling: using the
246 <literal>malloc_alloc</literal> template with your objects (not
247 portable, but should work for gcc) or even writing your own
248 memory allocators. But all this goes beyond the scope of this
249 FAQ. Start by reading <ulink
250 url="http://gcc.gnu.org/onlinedocs/libstdc++/ext/howto.html#3">
251 http://gcc.gnu.org/onlinedocs/libstdc++/ext/howto.html#3</ulink>
252 if you absolutely want to do that. But beware:</para>
253
254 <orderedlist>
255 <listitem>
256 <para>there are currently changes underway for gcc which are
257 not totally reflected in the docs right now ("now" == 26 Apr
258 03)</para>
259 </listitem>
260 <listitem>
261 <para>allocators belong to the more messy parts of the STL
njnd0d64732005-04-16 14:58:34 +0000262 and people went to great lengths to make it portable across
njn3e986b22004-11-30 10:43:45 +0000263 platforms. Chances are good that your solution will work on
264 your platform, but not on others.</para>
265 </listitem>
266 </orderedlist>
267 </answer>
268</qandaentry>
269
270
271<qandaentry id="faq.unhelpful">
de9bec93c2005-11-25 05:36:48 +0000272 <question id="q-unhelpful">
njn3e986b22004-11-30 10:43:45 +0000273 <para>The stack traces given by Memcheck (or another tool)
274 aren't helpful. How can I improve them?</para>
275 </question>
de9bec93c2005-11-25 05:36:48 +0000276 <answer id="a-unhelpful">
njn3e986b22004-11-30 10:43:45 +0000277 <para>If they're not long enough, use
278 <literal>--num-callers</literal> to make them longer.</para>
279 <para>If they're not detailed enough, make sure you are
280 compiling with <literal>-g</literal> to add debug information.
281 And don't strip symbol tables (programs should be unstripped
282 unless you run 'strip' on them; some libraries ship
283 stripped).</para>
284
njn0211ff32005-05-15 14:49:24 +0000285 <para>Also, for leak reports involving shared objects, if the shared
286 object is unloaded before the program terminates, Valgrind will discard
287 the debug information and the error message will be full of
288 <literal>???</literal> entries. The workaround here is to avoid calling
289 dlclose() on these shared objects.
290 </para>
291
njn3e986b22004-11-30 10:43:45 +0000292 <para>Also, <literal>-fomit-frame-pointer</literal> and
293 <literal>-fstack-check</literal> can make stack traces
294 worse.</para>
295
296 <para>Some example sub-traces:</para>
297
njn15d7c342005-09-30 01:43:32 +0000298 <itemizedlist>
299 <listitem>
300 <para>With debug information and unstripped (best):</para>
njn3e986b22004-11-30 10:43:45 +0000301<programlisting>
302Invalid write of size 1
303 at 0x80483BF: really (malloc1.c:20)
304 by 0x8048370: main (malloc1.c:9)
305</programlisting>
njn15d7c342005-09-30 01:43:32 +0000306 </listitem>
njn3e986b22004-11-30 10:43:45 +0000307
njn15d7c342005-09-30 01:43:32 +0000308 <listitem>
309 <para>With no debug information, unstripped:</para>
njn3e986b22004-11-30 10:43:45 +0000310<programlisting>
311Invalid write of size 1
312 at 0x80483BF: really (in /auto/homes/njn25/grind/head5/a.out)
313 by 0x8048370: main (in /auto/homes/njn25/grind/head5/a.out)
314</programlisting>
njn15d7c342005-09-30 01:43:32 +0000315 </listitem>
njn3e986b22004-11-30 10:43:45 +0000316
njn15d7c342005-09-30 01:43:32 +0000317 <listitem>
318 <para>With no debug information, stripped:</para>
njn3e986b22004-11-30 10:43:45 +0000319<programlisting>
320Invalid write of size 1
321 at 0x80483BF: (within /auto/homes/njn25/grind/head5/a.out)
322 by 0x8048370: (within /auto/homes/njn25/grind/head5/a.out)
323 by 0x42015703: __libc_start_main (in /lib/tls/libc-2.3.2.so)
324 by 0x80482CC: (within /auto/homes/njn25/grind/head5/a.out)
325</programlisting>
njn15d7c342005-09-30 01:43:32 +0000326 </listitem>
njn3e986b22004-11-30 10:43:45 +0000327
njn15d7c342005-09-30 01:43:32 +0000328 <listitem>
329 <para>With debug information and -fomit-frame-pointer:</para>
njn3e986b22004-11-30 10:43:45 +0000330<programlisting>
331Invalid write of size 1
332 at 0x80483C4: really (malloc1.c:20)
333 by 0x42015703: __libc_start_main (in /lib/tls/libc-2.3.2.so)
334 by 0x80482CC: ??? (start.S:81)
335</programlisting>
njn15d7c342005-09-30 01:43:32 +0000336 </listitem>
njn3e986b22004-11-30 10:43:45 +0000337
njn15d7c342005-09-30 01:43:32 +0000338 <listitem>
339 <para>A leak error message involving an unloaded shared object:</para>
njn0211ff32005-05-15 14:49:24 +0000340<programlisting>
34184 bytes in 1 blocks are possibly lost in loss record 488 of 713
342 at 0x1B9036DA: operator new(unsigned) (vg_replace_malloc.c:132)
343 by 0x1DB63EEB: ???
344 by 0x1DB4B800: ???
345 by 0x1D65E007: ???
346 by 0x8049EE6: main (main.cpp:24)
347</programlisting>
njn15d7c342005-09-30 01:43:32 +0000348 </listitem>
349 </itemizedlist>
njn0211ff32005-05-15 14:49:24 +0000350
njn3e986b22004-11-30 10:43:45 +0000351 </answer>
352</qandaentry>
353
njn16eeb4e2005-06-16 03:56:58 +0000354<qandaentry id="faq.aliases">
de9bec93c2005-11-25 05:36:48 +0000355 <question id="q-aliases">
njn16eeb4e2005-06-16 03:56:58 +0000356 <para>The stack traces given by Memcheck (or another tool) seem to
357 have the wrong function name in them. What's happening?</para>
358 </question>
de9bec93c2005-11-25 05:36:48 +0000359 <answer id="a-aliases">
njn16eeb4e2005-06-16 03:56:58 +0000360 <para>Occasionally Valgrind stack traces get the wrong function names.
361 This is caused by glibc using aliases to effectively give one function two
362 names. Most of the time Valgrind chooses a suitable name, but very
363 occasionally it gets it wrong.
njn16eeb4e2005-06-16 03:56:58 +0000364 Examples we know of are printing 'bcmp' instead of 'memcmp', 'index'
365 instead of 'strchr', and 'rindex' instead of 'strrchr'.</para>
366 </answer>
367</qandaentry>
368
de9bec93c2005-11-25 05:36:48 +0000369</qandadiv>
njn3e986b22004-11-30 10:43:45 +0000370
371
de9bec93c2005-11-25 05:36:48 +0000372
373<!-- Memcheck doesn't find my bug -->
374<qandadiv id="faq.notfound" xreflabel="Memcheck doesn't find my bug">
njn3e986b22004-11-30 10:43:45 +0000375<title>Memcheck doesn't find my bug</title>
njn3e986b22004-11-30 10:43:45 +0000376
377<qandaentry id="faq.hiddenbug">
de9bec93c2005-11-25 05:36:48 +0000378 <question id="q-hiddenbug">
njn3e986b22004-11-30 10:43:45 +0000379 <para>I try running "valgrind --tool=memcheck my_program" and
380 get Valgrind's startup message, but I don't get any errors and
381 I know my program has errors.</para>
382 </question>
de9bec93c2005-11-25 05:36:48 +0000383 <answer id="a-hiddenbug">
njna11b9b02005-03-27 17:05:08 +0000384 <para>There are two possible causes of this.</para>
385
386 <para>First, by default, Valgrind only traces the top-level process.
njn3e986b22004-11-30 10:43:45 +0000387 So if your program spawns children, they won't be traced by
388 Valgrind by default. Also, if your program is started by a
389 shell script, Perl script, or something similar, Valgrind will
390 trace the shell, or the Perl interpreter, or equivalent.</para>
391
392 <para>To trace child processes, use the
393 <literal>--trace-children=yes</literal> option.</para>
394
395 <para>If you are tracing large trees of processes, it can be
396 less disruptive to have the output sent over the network. Give
397 Valgrind the flag
398 <literal>--log-socket=127.0.0.1:12345</literal> (if you want
399 logging output sent to <literal>port 12345</literal> on
400 <literal>localhost</literal>). You can use the
401 valgrind-listener program to listen on that port:</para>
402<programlisting>
403valgrind-listener 12345
404</programlisting>
405
406 <para>Obviously you have to start the listener process first.
njn49818412005-09-26 01:11:40 +0000407 See the manual for more details.</para>
njna11b9b02005-03-27 17:05:08 +0000408
409 <para>Second, if your program is statically linked, most Valgrind tools
410 won't work as well, because they won't be able to replace certain
411 functions, such as malloc(), with their own versions. A key indicator of
412 this is if Memcheck says:
413<programlisting>
414No malloc'd blocks -- no leaks are possible
415</programlisting>
416when you know your program calls malloc(). The workaround is to avoid
417statically linking your program.</para>
njn3e986b22004-11-30 10:43:45 +0000418 </answer>
419</qandaentry>
420
421
422<qandaentry id="faq.overruns">
de9bec93c2005-11-25 05:36:48 +0000423 <question id="q-overruns">
njn3e986b22004-11-30 10:43:45 +0000424 <para>Why doesn't Memcheck find the array overruns in this program?</para>
njn3e986b22004-11-30 10:43:45 +0000425<programlisting>
426int static[5];
427
428int main(void)
429{
430 int stack[5];
431
432 static[5] = 0;
433 stack [5] = 0;
434
435 return 0;
436}
437</programlisting>
njn04be8752005-08-26 21:01:32 +0000438 </question>
de9bec93c2005-11-25 05:36:48 +0000439 <answer id="a-overruns">
njn3e986b22004-11-30 10:43:45 +0000440 <para>Unfortunately, Memcheck doesn't do bounds checking on
441 static or stack arrays. We'd like to, but it's just not
442 possible to do in a reasonable way that fits with how Memcheck
443 works. Sorry.</para>
444 </answer>
445</qandaentry>
446
de9bec93c2005-11-25 05:36:48 +0000447</qandadiv>
njn3e986b22004-11-30 10:43:45 +0000448
449
de9bec93c2005-11-25 05:36:48 +0000450
451<!-- Miscellaneous -->
452<qandadiv id="faq.misc" xreflabel="Miscellaneous">
njn3e986b22004-11-30 10:43:45 +0000453<title>Miscellaneous</title>
njn3e986b22004-11-30 10:43:45 +0000454
455<qandaentry id="faq.writesupp">
de9bec93c2005-11-25 05:36:48 +0000456 <question id="q-writesupp">
njn3e986b22004-11-30 10:43:45 +0000457 <para>I tried writing a suppression but it didn't work. Can
458 you write my suppression for me?</para>
459 </question>
de9bec93c2005-11-25 05:36:48 +0000460 <answer id="a-writesupp">
njn3e986b22004-11-30 10:43:45 +0000461 <para>Yes! Use the
462 <computeroutput>--gen-suppressions=yes</computeroutput> feature
463 to spit out suppressions automatically for you. You can then
464 edit them if you like, eg. combining similar automatically
465 generated suppressions using wildcards like
466 <literal>'*'</literal>.</para>
467
468 <para>If you really want to write suppressions by hand, read
469 the manual carefully. Note particularly that C++ function
470 names must be <literal>_mangled_</literal>.</para>
471 </answer>
472</qandaentry>
473
474
475<qandaentry id="faq.deflost">
de9bec93c2005-11-25 05:36:48 +0000476 <question id="q=deflost">
njn3e986b22004-11-30 10:43:45 +0000477 <para>With Memcheck/Addrcheck's memory leak detector, what's
478 the difference between "definitely lost", "possibly lost",
479 "still reachable", and "suppressed"?</para>
480 </question>
de9bec93c2005-11-25 05:36:48 +0000481 <answer id="a-deflost">
njn49818412005-09-26 01:11:40 +0000482 <para>The details are in the Memcheck section of the user manual.</para>
njn3e986b22004-11-30 10:43:45 +0000483
484 <para>In short:</para>
485 <itemizedlist>
486 <listitem>
487 <para>"definitely lost" means your program is leaking memory
488 -- fix it!</para>
489 </listitem>
490 <listitem>
491 <para>"possibly lost" means your program is probably leaking
492 memory, unless you're doing funny things with
493 pointers.</para>
494 </listitem>
495 <listitem>
496 <para>"still reachable" means your program is probably ok --
497 it didn't free some memory it could have. This is quite
498 common and often reasonable. Don't use
499 <computeroutput>--show-reachable=yes</computeroutput> if you
500 don't want to see these reports.</para>
501 </listitem>
502 <listitem>
503 <para>"suppressed" means that a leak error has been
504 suppressed. There are some suppressions in the default
505 suppression files. You can ignore suppressed errors.</para>
506 </listitem>
507 </itemizedlist>
de9bec93c2005-11-25 05:36:48 +0000508 </answer>
njn3e986b22004-11-30 10:43:45 +0000509</qandaentry>
510
de9bec93c2005-11-25 05:36:48 +0000511</qandadiv>
njn3e986b22004-11-30 10:43:45 +0000512
de9bec93c2005-11-25 05:36:48 +0000513
514
515<!-- Further Assistance -->
516<qandadiv id="faq.help" xreflabel="How To Get Further Assistance">
517<title>How To Get Further Assistance</title>
518
519<qandaentry id="e-help">
520
521 <answer id="a-help">
522 <para>Please read all of this section before posting.</para>
523
524 <para>If you think an answer is incomplete or inaccurate, please
525 e-mail <ulink url="mailto:&vg-vemail;">&vg-vemail;</ulink>.</para>
de97ab7e72005-11-27 18:19:40 +0000526<!--
de252c6142005-11-27 04:10:00 +0000527 <para>Read the appropriate section(s) of the <xref linkend="set-index"/>.</para>
de97ab7e72005-11-27 18:19:40 +0000528-->
529 <para>Read the appropriate section(s) of the
530 <ulink url="&vg-bookset;">Valgrind Documentation</ulink>.</para>
de9bec93c2005-11-25 05:36:48 +0000531
de97ab7e72005-11-27 18:19:40 +0000532<!--
de252c6142005-11-27 04:10:00 +0000533 <para>Read the <xref linkend="dist"/>.</para>
de97ab7e72005-11-27 18:19:40 +0000534-->
535 <para>Read the
536 <ulink url="&vg-dist-docs;">Distribution Documents</ulink>.</para>
de9bec93c2005-11-25 05:36:48 +0000537
538 <para><ulink url="http://search.gmane.org">Search</ulink> the
539 <ulink url="http://news.gmane.org/gmane.comp.debugging.valgrind">valgrind-users</ulink> mailing list archives, using the group name
540 <computeroutput>gmane.comp.debugging.valgrind</computeroutput>.</para>
541
542 <para>Only when you have tried all of these things and are still stuck,
543 should you post to the <ulink url="&vg-users-list;">valgrind-users
544 mailing list</ulink>. In which case, please read the following
545 carefully. Making a complete posting will greatly increase the chances
546 that an expert or fellow user reading it will have enough information
547 and motivation to reply.</para>
548
549 <para>Make sure you give full details of the problem,
550 including the full output of <computeroutput>valgrind -v</computeroutput>,
551 if applicable. Also which Linux distribution you're using (Red Hat, Debian, etc)
552 and its version number.</para>
553
554 <para>You are in little danger of making your posting too long
555 unless you include large chunks of valgrind's (unsuppressed)
556 output, so err on the side of giving too much information.</para>
557
558 <para>Clearly written subject lines and message bodies are appreciated,
559 too.</para>
560
561 <para>Finally, remember that, despite the fact that most of the
562 community are very helpful and responsive to emailed questions,
563 you are probably requesting help from unpaid volunteers, so you
564 have no guarantee of receiving an answer.</para>
565</answer>
566
567</qandaentry>
568</qandadiv>
569
570
571<!-- FAQ ends here -->
njn3e986b22004-11-30 10:43:45 +0000572</qandaset>
de9bec93c2005-11-25 05:36:48 +0000573
njn3e986b22004-11-30 10:43:45 +0000574
575
576<!-- template
de9bec93c2005-11-25 05:36:48 +0000577<qandadiv id="faq.installing" xreflabel="Installing">
578<title>Installing</title>
njn3e986b22004-11-30 10:43:45 +0000579
de9bec93c2005-11-25 05:36:48 +0000580<qandaentry id="faq.problem">
581 <question id="q-problem">
njn3e986b22004-11-30 10:43:45 +0000582 <para></para>
583 </question>
de9bec93c2005-11-25 05:36:48 +0000584 <answer id="a-problem">
njn3e986b22004-11-30 10:43:45 +0000585 <para></para>
586 </answer>
587</qandaentry>
588
de9bec93c2005-11-25 05:36:48 +0000589</qandadiv>
njn3e986b22004-11-30 10:43:45 +0000590-->
591
de9bec93c2005-11-25 05:36:48 +0000592</article>
njn3e986b22004-11-30 10:43:45 +0000593
594</book>