Require help in valgrind output Understanding

see i am just using valgrind for detecting memory leakage in my code. so i have used

valgrind -v --leak-check=full --show-reachable=yes ./my_binary

i see following out which i can not understand

`==16545== ==16545== HEAP SUMMARY: ==16545== in use at exit: 20,171 bytes in 647 blocks ==16545== total heap usage: 993 allocs, 346 frees, 30,090 bytes allocated ==16545== ==16545== Searching for pointers to 647 not-freed blocks ==16545== Checked 124,548 bytes ==16545== ==16545== 1 bytes in 1 blocks are still reachable in loss record 1 of 253 ==16545== at 0x400677E: malloc (vg_replace_malloc.c:195) ==16545== by 0x80AAB31: xmalloc (in /bin/bash) ==16545== by 0x80796D0: make_variable_value (in /bin/bash) ==16545== by 0x80798C8: ??? (in /bin/bash) ==16545== by 0x807BA40: initialize_shell_variables (in /bin/bash) ==16545== by 0x805E897: ??? (in /bin/bash) ==16545== by 0x805FA10: main (in /bin/bash) ==16545== ==16545== 1 bytes in 1 blocks are still reachable in loss record 2 of 253 ==16545== at 0x400677E: malloc (vg_replace_malloc.c:195) ==16545== by 0x80AAB31: xmalloc (in /bin/bash) ==16545== by 0x80A578B: set_locale_var (in /bin/bash) ==16545== by 0x80A5912: set_default_lang (in /bin/bash) ==16545== by 0x805FA15: main (in /bin/bash) ==16545== ==16545== 1 bytes in 1 blocks are still reachable in loss record 3 of 253 ==16545== at 0x400677E: malloc (vg_replace_malloc.c:195) ==16545== by 0x80AAB31: xmalloc (in /bin/bash) ==16545== by 0x8061B9B: ??? (in /bin/bash) ==16545== by 0x8062D95: ??? (in /bin/bash) ==16545== by 0x8065481: ??? (in /bin/bash) ==16545== by 0x806801A: yyparse (in /bin/bash) ==16545== by 0x8060580: parse_command (in /bin/bash) ==16545== by 0x806064F: read_command (in /bin/bash) ==16545== by 0x80608AE: reader_loop (in /bin/bash) ==16545== by 0x805FEFB: main (in /bin/bash)`e

i just want to understand this.? why this does not giving me particular line no in ma code which has not freed ?

-------------Problems Reply------------

These errors come from /bin/bash not from your own code. Are you running any bash scripts from your code? Here is explanation of what it means. I think you can just ignore it.

"still reachable" means your program is probably ok -- it didn't free some memory it could have. This is quite common and often reasonable. Don't use --show-reachable=yes if you don't want to see these reports.

It looks like those addresses belong to your program's code. Perhaps compiling with debug information lets valgrind see line numbers. (Hint: -g switch on gcc)

Have you checked ? There is a good documentation there. You shouldn't have used any optimization while you're compiling.

If you want to check the result of an autotools-powered compilation (it really creates a shell script in your build dir), you might want to try this instead:

libtool --mode=execute valgrind -v --leak-check=full --show-reachable=yes ./my_binary

Category:c# Views:1 Time:2011-08-26

Related post

  • Valgrind output confusing 2011-06-08

    I am having a bit of trouble understanding the Valgrind output: 1> "Invalid write of size 4" is coming up in an auto-generated adb file, return (gnat_exit_status); -- this is line 314 of b~main.adb and the gnat_exit_status is defined like this: gn

  • malloc.c:3074 + Valgrind output 2010-06-23

    I am getting the infamous malloc.c:3074 error when running my code (compiles without issue). I compiled using the -g option. I used Valgrind to determine where the memory allocation issue is happening but the results aren't helping a whole lot. Here

  • Valgrind output interpretation 2010-10-26

    Let arr be an array of dimension 16 x 20 Here is the valgrind output for the code snippet mentioned. The output is from cachegrind. for (i = 0; i < 20; i++) arr[0][i] = 0; Ir I1mr I2mr Dr D1mr D2mr Dw D1mw D2mw 64 0 0 41 0 0 1 0 0 60 0 0 20 0 0 20

  • Can someone help me to analyze these valgrind output? 2012-03-23

    I wrote a C program on linux to process large amount of data, it run OK most of the time. But when processing a set of particular data it always told me the 'segmentation fault' error, I tried to use gdb without luck (see my another question How to d

  • Understanding valgrind output 2011-01-20

    I am new to linux. How can I interpret the following output from valgrind --tool=memcheck --leak-check=yes ./main It says some blocks are lost. How can I nail down memory leaks. ==2599== HEAP SUMMARY: ==2599== in use at exit: 17,327 bytes in 55 block

  • Valgrind output showing addresses not code against errors 2010-02-26

    I am running Valgrind on my program. It shows me two errors but mentions only addresses against them and not actual code even on a debug build. Could you pls. help me understand what it says and how to reach the erroneous line of code? The output is

  • Why do I get an error "-depends on uninitialised value" in valgrind output? 2011-08-30

    How can I suppress this error in valgrind's output? ==16727== 1 errors in context 2 of 18: ==16727== Conditional jump or move depends on uninitialised value(s) What causes this error? Can I just ignore it? --------------Solutions------------- It mean

  • Minimum requirements for escaping HTML output 2010-06-22

    What are the characters that are required and suffice when escaping user-generated content before output? (in other words: what are the characters web developers should escape when outputting text that previously came from an untrusted, anonymous sou

  • Can valgrind output partial reports without having to quit the profiled application? 2012-03-15

    I want to check a long running process for memory leaks with valgrind. I suspect the memory leak I'm after might happen only after several hours of execution. I can run the app under valgrind and get the valgrind log just fine, but doing so means I h

  • Symbolicate Output - Understanding the error 2011-05-06

    My App is crashing a "14". I have a business object called "ClientDetail" but this object has no Bools. What is it referring to? There is also no line 784, I am guessing the + 784 is then not a line number reference? 13 HappyApp 0x008b907c handle_sig

  • Why is valgrind outputting file paths instead of a line number for the errors? 2012-02-04

    ==11260== Invalid write of size 4 ==11260== at 0x402872: b2_createPair (in /home/david/Documents/programming/366 terminal/mainout ==11260== by 0x402BE9: b2_populateBigBucket (in /home/david/Documents/programming/366 terminal/mainout) ==11260== by 0x4

  • How do I set up Windows Mail ? I do not know how to answer the required questions and do not understand the windows help. 2012-01-19

    I have wireless broad band hot zone type connection. I am using Vista. --------------Solutions------------- Who is your mail server? Windows Mail: Setting up an account from start to finish

  • Understanding TransactionScopeOptions: RequiresNew = Suppress + Required? 2011-08-08

    I believe I understand TransactionScopeOption.Suppress and TransactionScopeOption.Required but am having difficulty understanding what TransactionScopeOption.RequiresNew does. Based on the last explanation that I read, would the following two blocks

  • PHP callback with arguments via SWIG generates uninitialised values in valgrind 2012-03-17

    I'm trying to understand why valgrind complains about 'Conditional jump or move depends on uninitialised value(s)' in the code below. I took the callback example in swig 2.0.4 and added an argument to the callback. Can anyone help me understand why t

  • Output compile time stamp in Visual C++ executable? 2008-08-25

    How can I insert compilation timestamp information into an executable I build with Visual C++ 2005? I want to be able to output something like this when I execute the program: This build XXXX was compiled at dd-mm-yy, hh:mm. where date and time refle

  • Should you design websites that require JavaScript in this day & age? 2008-09-15

    It's fall of 2008, and I still hear developers say that you should not design a site that requires JavaScript. I understand that you should develop sites that degrade gracefully when JS is not present/on. But at what point do you not include funciton

  • Understanding Dijkstra's Mozart programming style 2008-11-15

    I came across this article about programming styles, seen by Edsger Dijsktra. To quickly paraphrase, the main difference is Mozart, when the analogy is made to programming, fully understood (debatable) the problem before writing anything, while Beeth

  • Still Reachable Leak detected by Valgrind 2010-10-01

    All the functions mentioned in this block are library functions. How can I rectify this memory leak? It is listed under the "Still reachable" category. (There are 4 more, which are very similar, but of varying sizes) 630 bytes in 1 blocks are still r

  • Redirecting standard output when generated 2010-12-18

    I am trying to redirect the output of a c program which generates output in the console. I can redirect the output once the process exits. But is there the way to redirect the output as and when there is some output in the shell window? I require thi

Copyright (C), All Rights Reserved.

processed in 0.104 (s). 11 q(s)